基于多项滤波的数字正交变换MATLAB仿真程序

function filter_emu( Num )
%UNTITLED Summary of this function goes here
%   Detailed explanation goes here
%num_size = sizeof(Num);
%利用多项滤波器的分支特性获得两个有半个采样点时延的低通滤波器系数

filt1 = zeros(1,8);
filt2 = zeros(1,8);
for m = 1:64
    if(mod(m,8) == 4)
        filt1(i) = Num(m);
    end
    if(mod(m,8) == 0)
        filt2(i) = Num(m);
        i = i + 1;
    end
end
%------生成窄带信号,中频150MHz,带宽不大于20MHz
%------仿真信号x(t)=a(t)*cos[2*pi*f0*t+phi(t)]
f0 = 1.5e8;     %中心频率
fs = 2e8;       %采样频率
N = 1600;       %取的样本点数
n = 0:N-1;      %取的样本序列
t = n/fs;       %获得以1/fs为时间间隔的采样序列
%a = 1+cos(2*pi*1000*t);      
                %获取a(t)的采样点
phi = 2*pi*2e6;
                %获取phi
xt = cos(2*pi*f0*t+phi*t);
                %生成窄带信号并获取其采样点
%------进行2倍抽取并混频
nt = 1:N/20;
xi = xt(2*nt).*((-1).^nt);  %获取同相分量
xq = xt(2*nt-1).*((-1).^nt);%获取正交分量

%------打印同相分量与正交分量
figure(1);
plot(nt,xi,'r');
hold on;
plot(nt,xq,'g');
grid on;
%------滤波
x1 = filter(filt1,1,xi);
x2 = filter(filt2,1,xq);
%------打印恢复后的同相正交分量
figure(2);
plot(nt,x1,'r');
hold on;
plot(nt,x2,'g');
grid on;

end
注:Num为生成的63阶FIR滤波器系数存放的数组,通过fdatool工具得到。

你可能感兴趣的:(信号处理)