您好,欢迎来到筏尚旅游网。
搜索
您的当前位置:首页FIR滤波器设计代码

FIR滤波器设计代码

来源:筏尚旅游网


方法一

clear all;

close all;

M1=21;

wc=0.5*pi;

a=(M1-1)/2;

n=[0:1:(M1-1)];

m=n-a+eps;

hd1=sin(wc*m)./(pi*m);

wn1=boxcar(M1);

hn1=hd1.*wn1';

[hw1,w1]=freqz(hn1,1);

M2=21;

n=[0:1:(M2-1)];

a=(M2-1)/2;

m=n-a+eps;

hd2=sin(wc*m)./(pi*m);

wn2=Hanning(M2);

hn2=hd2.*wn2';

[hw2,w2]=freqz(hn2,1);

subplot(321);

stem(hn1);

subplot(322);

stem(hn2);

subplot(323);

plot(w1/pi,20*log10(abs(hw1)/abs(hw1(1))));

subplot(324);

plot(w2/pi,20*log10(abs(hw2)/abs(hw2(1))));

subplot(325);

plot(w1,unwrap(angle(hw1)));

subplot(326);

plot(w2,unwrap(angle(hw2)));

方法二

clear all;

close all;

M1=21;

wc=0.5*pi;

a=(M1-1)/2;

n=[0:1:(M1-1)];

m=n-a+eps;

hd1=sin(wc*m)./(pi*m);

wn1=boxcar(M1);

hn1=hd1.*wn1';

freqz(hn1,1);

figure;

M2=21;

n=[0:1:(M2-1)];

a=(M2-1)/2;

m=n-a+eps;

hd2=sin(wc*m)./(pi*m);

wn2=Hanning(M2);

hn2=hd2.*wn2';

freqz(hn2,1);

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- efsc.cn 版权所有

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务