- 经验
- 4
- 分贝
- 0
- 家园分
- 12
- 在线时间:
- 2 小时
- 最后登录:
- 2020-5-5
- 帖子:
- 3
- 精华:
- 0
- 注册时间:
- 2020-5-1
- UID:
- 1498086
注册:2020-5-1
|
%MSK调制函数
function [I_out,Q_out] = mod_msk(data,data_len,sample_number,Rb)
Tb = 1/Rb; %码元周期
fs = Rb*sample_number; %采样速率
[data_diff] = difference(data); %差分编码
I(1) = 1; %串并转换
for i = 1:2:data_len
Q(i) = data_diff(i);
Q(i+1) = data_diff(i);
end
for i = 2:2:data_len
I(i+1) = data_diff(i);
I(i) = data_diff(i);
end
for i = 1:sample_number %采样
I1(i:sample_number:data_len*sample_number) = I(1:data_len);
Q1(i:sample_number:data_len*sample_number) = Q(1:data_len);
end
t=1/fs:1/fs:data_len*Tb;
I_out = I1 .* cos(pi*t/2/Tb); %乘上加权函数
Q_out = Q1 .* sin(pi*t/2/Tb); %乘上加权函数
%主函数
data_len = 10000; %码元个数
sample_number = 8; %每个码元的采样点数
Rb = 24000; %码率
fc = 96000; %载波频率
data=rand_binary(data_len); %随机数发生器
[I_out,Q_out] = mod_msk(data,data_len,sample_number,Rb); %MSk调制
multi = fc/Rb;
I_temp=interp(I_out,multi);
Q_temp=interp(Q_out,multi);
Fs=fc*sample_number;
t=1/Fs:1/Fs:length(I_temp)*1/Fs;
signal_i=I_temp.*cos(2*pi*fc*t); %乘上载波
signal_q=Q_temp.*sin(2*pi*fc*t); %乘上载波
signal_mod=I_temp.*cos(2*pi*fc*t)-Q_temp.*sin(2*pi*fc*t); %调制信号生成
plot(t,signal_mod)
这是网上找的一段代码,但是运行出来的图和正常的MSK调制图不一样,是不是哪里需要修改?应该怎么改?
这是运行图
|
|