[转载]用matlab对象进行数字基带调制解调(MQAM)

原文地址:用matlab对象进行数字基带调制解调(MQAM) 作者:hahaer
%% 仿真实现基带general QAM调制与解调
%% 利用Matlab modem object
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   h = modem.genqammod(property1, value1, ...)
%   h = modem.genqammod(GENQAMdemod_object)
%   h = modem.genqammod(GENQAMdemod_object, property1,value1, ...)
%   h = modem.genqammod
%   if you have creat an object h for general QAM modulate, then the method
%   'modulate' can be used to modulate your signal x such as:
%   y = modulate(h, x)
%   and demodulation method need to creat an object
%   h = modem.genqamdemod(property1, value1, ...)
%   h = modem.genqamdemod(GENQAMmod_object)
%   h = modem.genqamdemod(GENQAMmod_object, property1,value1, ...)
%   h = modem.genqamdemod
%   if you have creat an object h for general QAM demodulate, then the method
%   'demodulate' can be used such as
%   y = demodulate(h, x)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc
clear all
close all hidden
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
M = 16;
nPacket = 5000;           % The signal length
x = randint(nPacket,1,M); % Signal for modulate

 % Creat an object of general QAM modulation
h = modem.genqammod('Constellation', exp(j*2*pi*[0:M-1]/M));      
y = modulate(h,x);        % modulate x get y
scatterplot(y);
yn = awgn(y,15,'measured'); % Pass the gauss channel with SNR=15dB
scatterplot(yn);
reset(h);                      
h = modem.genqamdemod('Constellation', exp(j*2*pi*[0:M-1]/M));
z = demodulate(h,yn);
[num,rt]= symerr(x,z)

%% Process rectanglar pulse shaping
Nsamp = 4;               % Oversampling rate
ypulse = rectpulse(y,Nsamp);
ynoisy = awgn(ypulse,15,'measured');
ydownsamp = intdump(ynoisy,Nsamp);
scatterplot(ydownsamp);
reset(h);
h = modem.genqamdemod('Constellation', exp(j*2*pi*[0:M-1]/M));
z = demodulate(h,ydownsamp);
[num,rt]= symerr(x,z)

你可能感兴趣的:([转载]用matlab对象进行数字基带调制解调(MQAM))