?? mpsk_gen.m
字號(hào):
function [x]=mpsk_gen(M,fl,t,d)
% [x]=mpsk_gen(M,fl,t,d);
% example:
% [x]=mpsk_gen(4,1000,1,1);
% 'M'--mpsk modulation type 2/4/8/16
% 'fl'-- signal rate
% 't'-- time last
% 'd'-- amplititude of symbols
error(nargchk(1,4,nargin));
if M<=0
error('Wrong parameter, the value of M must be greater than 0')
end
if M>8
error('Wrong parameter, the value of M must be less than 8')
end
if mod(M,2)~=0
error('Wrong parameter, the value of M must be 2,4,16,32,64')
end
if nargin==1
N=1000;d=1;
elseif nargin==3
d=1;
end
N=fix(fl*t);
p=0;
%generation of the data source follows
for i=1:N
temp=rand; % a uniform R.V. between 0 and 1
dsource(i)=1+floor(M*temp); % a number between 1 and M, uniform
end;
% mapping to the signal constellation follow
map=[0:M-1].*2*pi/M;
for i=1:N
psk_sig(i)=map(dsource(i));
x1(i)=d.*cos(psk_sig(i)+p);
x2(i)=d.*sin(psk_sig(i)+p);
% x1(i)=d.*cos(psk_sig(i));
% x2(i)=d.*sin(psk_sig(i));
end;
x=x1-j*x2;
return
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -