主要是为了测试下变频对信号信噪比的影响。
下变频主要包括:频率搬移+低通滤波+抽取信号来实现
代码如下:
close all;clc;clear all;
fs = 150e6; %原始数据采样率
fc = 46.519e6;%信号中频
fdown = 30e6;%下变频率
n = fs*0.001;
bit_width = 8
ts = 1/fs;
nn = [1:1:n];
fid = fopen('D:\work\常用重要\test_xiabianpin20150324\RxRec20150323_181158.dat','r');
data = fread(fid,[1,n],'bit8');
figure
pwelch(data)
%下变频
data_i = data .* lianghua_bit(cos(2*pi*fdown*ts*nn),bit_width)/2^bit_width;
data_q = data .* lianghua_bit(sin(2*pi*fdown*ts*nn),bit_width)/2^bit_width;
figure
pwelch(data_i)
% figure
% pwelch(data_q)
%低通滤波
fir_conficient = fir1(20,0.2);
figure
freqz(fir_conficient,1,512);
data_out_i = filter (fir_conficient,1,data_i);
data_out_q = filter (fir_conficient,1,data_q);
figure
pwelch(data_out_i)
% figure
% pwelch(data_out_q)
%抽取
for i = 1:floor(length(data_out_i))/3
x_i(i) = sum(data_out_i((i-1)*3+1
i-1)*3+3))/3;
end
for i = 1:floor(length(data_out_i))/3
x_q(i) = sum(data_out_q((i-1)*3+1
i-1)*3+3))/3;
end
%然后把数据考到另一组程序中对信号采集信号信噪比进行检测
运行结果如下:
原始信号频谱:
把频谱搬移后的图把频谱搬移后的图:
低通滤波器的幅频特**:
文章评论(0条评论)
登录后参与讨论