资源描述:
《用升余弦窗设计一线性相位低通fir数字滤波器》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、用升余弦窗设计一线性相位低通FIR数字滤波器N=15时:n=0:14;n1=n-7;nn=n1+(n1==0)*eps;hd=sin(pi/4*nn)./(pi*nn);title('N=15h1');h1=hd.*(hanning(15))';subplot(4,1,1);stem(n,h,'.');axis([0,14,-0.1,0.3]);[h11,m]=freqz(h1,1,1024);mag=abs(h11);ang=angle(h11);mag1=mag/max(mag);subplot(4,1,2);plot(m,mag1,'k');ax
2、is([0,3.5,-0.1,1.2]);title('N=15幅频特性');subplot(4,1,3);plot(m,ang,'k');title('N=15相位特性');a=20*log10(mag1);subplot(4,1,4);plot(m,a,'k');axis([0,3.5,-120,20]);title('N=15衰减特性');N=33时:n=0:32;n1=n-16;nn=n1+(n1==0)*eps;hd=sin(pi/4*nn)./(pi*nn);h1=hd.*(hanning(33))';subplot(4,1,1);stem
3、(n,h1,'k.');axis([0,32,-0.1,0.3]);title('N=33h1');[h11,m]=freqz(h1,1,1024);mag=abs(h11);ang=angle(h11);mag1=mag/max(mag);subplot(4,1,2);plot(m,mag1,'k');axis([0,3.5,-0.1,1.2]);title('N=33幅频特性');subplot(4,1,3);plot(m,ang,'k');title('N=33¹相位特性');a=20*log10(mag1);subplot(4,1,4);plo
4、t(m,a,'k');axis([0,3.5,-150,20]);title('N=33¹衰减特性');用四种窗函数设计线性相位低通滤波器n=0:32;n1=n-16;nn=n1+(n1==0)*eps;hd=sin(pi/4*nn)./(pi*nn);h1=hd;[h11,m]=freqz(h1,1,1024);mag=abs(h11);mag1=mag/max(mag);a1=20*log10(mag1);subplot(4,2,1);plot(m,mag1,'k');axis([0,3.5,-0.1,1.2]);title('矩形窗幅频特性');
5、subplot(4,2,2);plot(m,a1,'k');axis([0,3.5,-150,20]);title('矩形窗衰减特性');h2=hd.*(boxcar(33))';[h22,m]=freqz(h2,1,1024);mag=abs(h22);mag2=mag/max(mag);a2=20*log10(mag2);subplot(4,2,3);plot(m,mag2,'k');axis([0,3.5,-0.1,1.2]);title('三角窗幅频特性');subplot(4,2,4);plot(m,a2,'k');axis([0,3.5,-
6、150,20]);title('三角窗衰减特性');h3=hd.*(hamming(33))';[h33,m]=freqz(h3,1,1024);mag=abs(h33);mag3=mag/max(mag);a3=20*log10(mag3);subplot(4,2,5);plot(m,mag3,'k');axis([0,3.5,-0.1,1.2]);title('汉宁窗幅频特性');subplot(4,2,6);plot(m,a3,'k');axis([0,3.5,-150,20]);title('汉宁窗衰减特性');h4=hd.*(hanning(
7、33))';[h44,m]=freqz(h4,1,1024);mag=abs(h44);mag4=mag/max(mag);a4=20*log10(mag4);subplot(4,2,7);plot(m,mag4,'k');axis([0,3.5,-0.1,1.2]);title('哈明窗幅频特性');subplot(4,2,8);plot(m,a4,'k');axis([0,3.5,-150,20]);title('哈明窗衰减特性');