您好,欢迎访问三七文档
当前位置:首页 > 行业资料 > 冶金工业 > fir低通高通带通带阻m文件
clcclearallcloseallT1=0.5925;T2=0.1399;N=36;%wpl=0.35pi,wph=0.65pi,wsl=0.25pi,wsh=0.75pi,Apl=2db,Aph=2db,Asl=20db,Ash=20db%k=N*w/2pialpha=(N-1)/2;l=0:N-1;Hrs=[zeros(1,6),T1,ones(1,7),T1,zeros(1,6),T1,ones(1,7),T1,zeros(1,6)];Hdr=[001100];wdl=[06/N6/N14/N14/N0.5];angH=-pi*l.*(N-1)/N;H=Hrs.*exp(j*angH);h1=ifft(H,N);h=fft(h1,1024);h2=fft(h1.*hann(length(h1)).',1024);figureplot([0:(N-1)]/N,Hrs,'pr');axis([01-0.11.1]);title('Bandpass')gridholdonplot([0:1023]/1024,abs(h2),'k');axis([00.5-0.11.1]);title('amplituderesponse')holdonplot(wdl,Hdr)holdonplot([0:1023]/1024,abs(h),'m')clcclearallcloseallT1=0.1095;T2=0.598;N=61;alpha=(N-1)/2;l=0:N-1;wl=(2*pi/N)*l;Hrs=[zeros(1,22),T1,T2,ones(1,14),T2,T1,zeros(1,21)];Hdr=[0011];wdl=[021.5/N24/N0.5];angH=-pi*l.*(N-1)/N;Hdk=Hrs.*exp(j*angH);h1=ifft(Hdk,N);h2=fft(h1,1024);h3=fft(h1.*hann(length(h1)).',1024);figureplot([0:N-1]/N,Hrs,'pr',wdl,Hdr);title('lowpass')holdon;plot([0:1023]/1024,abs(h3),'k');title('Magnituderesponse')holdonplot([0:1023]/1024,abs(h2),'m');gridonaxis([00.5-0.11.1]);clcclearallcloseallT1=0;T2=0.5925;N=60;alpha=(N-1)/2;l=0:N-1;Hrs=[ones(1,7),T2,T1,zeros(1,43),T1,T2,ones(1,6)];Hdr=[1100];wdl=[06/N8/N0.5];k1=0:floor((N-1)/2);k2=floor((N-1)/2)+1:N-1;angH=[-alpha*(2*pi)/N*(k1),alpha*(2*pi)/N*(N-k2)];Hdk=Hrs.*exp(j*angH);h=ifft(Hdk,N);h2=fft(h,1024);h3=fft(h.*hann(length(h)).',1024);figureplot([0:N-1]/N,Hrs,'pr',wdl,Hdr);title('lowpass')holdon;plot([0:1023]/1024,abs(h2),'r');holdon;plot([0:1023]/1024,abs(h3),'k');title('Magnituderesponse')gridonaxis([00.5-0.11.1]);clcclearallcloseallT1=0.1095;N=41;alpha=(N-1)/2;l=0:N-1;wl=(2*pi/N)*l;Hrs=[ones(1,6),T1,zeros(1,7),T1,ones(1,11),T1zeros(1,7),T1,ones(1,6)];Hdr=[110011];wdl=[06/N6/N14/N14/N0.5];k1=0:floor((N-1)/2);k2=floor((N-1)/2)+1:N-1;angH=-pi*l.*(N-1)/N;H=Hrs.*exp(j*angH);h1=ifft(H,N);h2=fft(h1.*hann(length(h1)).',1024);h3=fft(h1,1024);figureplot([0:N-1]/N,Hrs,'pk',wdl,Hdr);title('lowpass')holdon;plot([0:1023]/1024,abs(h2),'k');holdon;plot([0:1023]/1024,abs(h3),'m');title('Magnituderesponse')gridonaxis([00.5-0.11.1]);
本文标题:fir低通高通带通带阻m文件
链接地址:https://www.777doc.com/doc-2871810 .html