% author:张宗卫
% description:多相抽取滤波器设计仿真
% date:2020.2.2
%使用带通采样定律对射频信号直接采样,fs=6.2M,载波9.8M,经过采样后频谱搬移至2.6m,
%针对目前比较流行的204B接口,数据随路时钟clk=fs/4,一个时钟周期传输四个采样点,特别适合%多相抽取滤波器设计,该仿真使用此滤波器结构设计了带通滤波器实现载波9.8M和9.79M信号的
%分离,适合用于信道化滤波器设计。
clc
clear all
load('Bpf2600Coe.mat')%导入滤波器参数,该滤波器为fc1经过带通采样后
fs=620*10e3;%采样频率
f1=980*10e3;
f2=979*10e3;
% step1 产生脉冲
L=600000;
t=1/fs:1/fs:L/fs;
am=zeros(1,L);
TPulse=125;
t1=(4/1000)*fs;
t2=400000;
t3=424800;
for i=1:(4/1000)*fs
am(i)=sin(2*pi*TPulse*t(i));
end
for i=1:t1
ts(i)=sin(2*pi*TPulse*t(i));
end
j=1;
for i=t2+1:t3
am(i)=ts(j);
j=j+1;
end
figure(1)
plot(t,am,'r');
title('脉冲调制信号');
%step2 将脉冲信号加调制
fc1=sin(2*pi*f1*t)*2^14;% 调制1
fc2=sin(2*pi*f2*t)*2^14;% 调制2
fs1=am.*fc1;
fs2=am.*fc2;
%第一个脉冲为fc1频率的调制,第二个脉冲为fc2频率的调制
for i=1:L
if(i<L/2)
Rec(i)=fs2(i);
else
Rec(i)=fs1(i);
end
end
figure(2)
plot(t,Rec)
title('射频脉冲信号');
%频谱分析
NFFT = 2^nextpow2(L); % Next power of 2 from length of y Y = fft(Rec,NFFT)/L;
f = fs/2*linspace(0,1,NFFT/2+1);
figure(3)
% Plot single-sided amplitude spectrum.
plot(f,2*abs(Y(1:NFFT/2+1)))
title('Single-Sided Amplitude Spectrum of y(t)')
xlabel('Frequency (Hz)')
ylabel('|Y(f)|')
%step3 该信号通过设计好的带通滤波器
fRec=filter(Num,1,Rec);
figure(4)
plot(t,fRec)
title('信号过带通滤波器')
%step4 多相滤波器设计仿真:思想,将抽取放在滤波器前,降低运算速率%滤波器分解
b1=Num(1:4:1503);
b2=Num(2:4:1503);
b3=Num(3:4:1503);
b4=Num(4:4:1503);
%数据分解
Rec1=Rec(1:4:L);
Rec2=Rec(2:4:L);
Rec3=Rec(3:4:L);
Rec4=Rec(4:4:L);
%四路数据分别过四个滤波器
frec1=filter(b1,1,Rec1);
frec2=filter(b2,1,Rec2);
frec3=filter(b3,1,Rec3);
frec4=filter(b4,1,Rec4);
%合成滤波数据
ffrec=frec1+frec2+frec3+frec4;
tt=t(1:4:L);
figure(5)
plot(tt,ffrec)
title('信号过多相抽取带通滤波器')。