FIR滤波器设计方法.pdfVIP

  • 12
  • 0
  • 约2.28千字
  • 约 4页
  • 2022-11-04 发布于上海
  • 举报
实验5 FI 滤波器设计方法 模拟原型Butterworth 滤波器: wp=0.4*pi;ws=0.6*pi;Rp=0.5;As=50; [b,a]=afd_butt(wp,ws,Rp,As); *** Butterworth Filter Order = 17 [db,mag,pha,w]=freqs_m(b,a,pi); [ha,x,t]=impulse(b,a,100); subplot(2,2,1);plot(w/pi,mag);xlabel(w);ylabel(|H|);grid on subplot(2,2,2);plot(w/pi,pha);xlabel(w);ylabel(相位); grid on subplot(2,2,3);plot(w/pi,db);xlabel(w);ylabel(db); grid on subplot(2,2,4);plot(t,ha);xlabel(t);ylabel(ha(t)); axis([0,100,-0.2,0.4]);grid on 双线性变换法求得的数字Butterworth 低通滤波器: wp=0.4*pi;ws=0.6*pi;Rp=0.5;As=50; T=2;OmegaP=(2/T)*tan(wp/2);OmegaS=(2/T)*tan(ws/2); N=ceil((log10((10^(Rp/10)-1)/(10^(As/10)-1)))/(2*log10(OmegaP/OmegaS))); OmegaC=OmegaP/((10^(Rp/10)-1)^(1/(2*N)));wn=2/pi*atan(OmegaC*T/2); [b,a]=butter(N,wn); [db,mag,pha,grd,w] = freqz_m(b,a); n=0:100; h=impz(b,a,n); subplot(2,2,1);plot(w/pi,mag);xlabel(w);ylabel(|H|); axis([0,1,0,1.15]);grid on subplot(2,2,2);plot(w/pi,pha);xlabel(w);ylabel(相位); axis([0,1,-4,4]); grid on subplot(2,2,3);plot(w/pi,db);xlabel(w);ylabel(db); axis([0,1,-140,20]); grid on subplot(2,2,4);stem(n,h);xlabel(n);ylabel(h(n)); axis([0,100,-0.2,0.4]);grid on 由前面的数字Butterworth 低通滤波器映射得到的高通滤波器: 接上面的程序 wp1=ws;ws1=wp; [N1,wn1]=buttord(wp1/pi,ws1/pi,Rp,As); [b1,a1]=butter(N1,wn1,high); [db1,mag1,pha1,grd1,w1] = freqz_m(b1,a1); h1=impz(b1,a1,n); subplot(2,2,1);plot(w1/pi,mag1);xlabel(w1);ylabel(|H1|);axis([0,1,0,1.15]);grid on subplot(2,2,2);plot(w1/pi,pha1);xlabel(w1);ylabel(相位); axis([0,1,-4,4]); grid on subplot(2,2,3);plot(w1/pi,db1);xlabel(w1);ylabel(db1); axis([0,1,-140,20]); grid on subplot(2,2,4);stem(n,h1);xlabel(n);ylabel(h1(n)); grid on 信号x(n)通过数字Butterworth 低通滤波器: 接上面程序 w1=0.3*pi;w2=0.7*pi; x=cos(w1*n)+cos(w2*n); [y,ny]=conv_m(x,n,h,n); X=dtft(x,n,w); Y=dtft(y,ny,w); magX=abs(X);magY=abs(Y);figure(2); subplot(2,2,1);stem(n,x);xlabel(n);ylabel(x(n));grid on subplot(2,2,2);plot(w/pi,magX);xlabel(w);ylabel(幅度|X|); gr

文档评论(0)

1亿VIP精品文档

相关文档