|
发表于 2022-11-8 14:29:14
|
显示全部楼层
msk调制程序:
Rb = 64000; %码速率
fc = 900000000; %载频
sample_num = 50; %每个码元采样点数
datanum = 1000; %产生的码元个数
data=rand_binary(datanum);%产生随机码元
ts = 1/sample_num/Rb; %采样时间间隔
%%
% %进行msk调制
Ts = 1/Rb; %单个码元时间
ts = Ts/sample_num; %采样点的时间间隔
f = 1/(4*Ts); %振荡频率
len = length(data);
fs = 1/ts;diffdata = diffen(data); %差分编码
P(1) = 1; %串并变换
for i = 1:2:datanum
Q(i) = diffdata(i);
Q(i+1) = diffdata(i);
end
for i = 2:2:datanum
P(i+1) = diffdata(i);
P(i) = diffdata(i);
end
for i = 1:sample_num %时延
datat(i:sample_num:len*sample_num) = data(1:len);
diffdatat(i:sample_num:len*sample_num) = diffdata(1:len);
Pt(i:sample_num:len*sample_num) = P(1:len);
Qt(i:sample_num:len*sample_num) = Q(1:len);
endt = 0:ts:len*Ts-ts; %步长保证了对应点采样的正确性
%对应采样点进行点乘加权
P1_out = Pt.*cos(2*pi*f*t);
Q1_out = Qt.*sin(2*pi*f*t); %与载波相乘
P_out=P1_out.*cos(2*pi*fc*t);
Q_out=Q1_out.*sin(2*pi*fc*t);datain = P_out-Q_out; %msk信号输出
plot(t,datain);
%%
for i=1:len*sample_num; %信道
naka1(i)=nakagami(0.5,1);
naka2(i)=nakagami(1,1);
naka3(i)=nakagami(2,1);
end
%%
data1=naka1.*datain; %通过信道后的信号
data2=naka2.*datain;
data3=naka3.*datain; |
|