用matlab对象进行数字基带调制解调(MPSK)
(2010-05-27 22:41:38)
标签:
杂谈 |
分类: 学术讨论 |
%% 仿真实现基带M-PSK调制与解调
%% 利用Matlab modem object
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% h = modem.pskmod(M)
% h = modem.pskmod(M,
phaseoffset)
% h = modem.pskmod(property1,
value1, ...)
% h =
modem.pskmod(PSKdemod_object)
% h =
modem.pskmod(PSKdemod_object, property1,value1, ...)
% h = modem.pskmod
% if you have creat an object h
for PSK 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.pskdemod(M)
% h = modem.pskdemod(M,
phaseoffset)
% h = modem.pskdemod(property1,
value1, ...)
% h = modem.pskdemod
% h =
modem.pskdemod(pskmod_object)
% h =
modem.pskdemod(pskmod_object, property1,value1, ...)
% if you have creat an object h
for PSK demodulate, then the method
% 'demodulate' can be used such
as
% y = demodulate(h, x)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc
clear all
close all hidden
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
M = 16;
% The order for modulate of PSK
nPacket = 5000;
% The signal length
x = randint(nPacket,1,M); % Signal for modulate
h = modem.pskmod(M);
% Creat an object of PSK modulation
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.pskdemod(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.pskdemod(M);
z = demodulate(h,ydownsamp);
[num,rt]= symerr(x,z)
%% 利用Matlab modem object
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc
clear all
close all hidden
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
M = 16;
nPacket = 5000;
x = randint(nPacket,1,M); % Signal for modulate
h = modem.pskmod(M);
y = modulate(h,x);
scatterplot(y);
yn = awgn(y,15,'measured'); % Pass the gauss channel with SNR=15dB
scatterplot(yn);
reset(h);
h = modem.pskdemod(M);
z = demodulate(h,yn);
[num,rt]= symerr(x,z)
%% Process rectanglar pulse shaping
Nsamp = 4;
ypulse = rectpulse(y,Nsamp);
ynoisy = awgn(ypulse,15,'measured');
ydownsamp = intdump(ynoisy,Nsamp);
scatterplot(ydownsamp);
reset(h);
h = modem.pskdemod(M);
z = demodulate(h,ydownsamp);
[num,rt]= symerr(x,z)

加载中…