1、IIR数字滤波器的设计clear;close allt=1; fs=4000;wpu=0.65*pi,wpl=0.45*pi;wsu=0.75*pi,wsl=0.30*pi;wpz=0.45,0.65;wsz=0.30,0.75;wp=2/t*tan(wpz/2);ws=2/t*tan(wsz/2);rp=1;as=40;n,wc=buttord(wp,ws,rp,as,s); %计算带通滤波器阶数N和3dB截止频率wcb,a=butter(n,wc,s); %计算带通滤波器系统函数分子分母多项式系数向量b,abz,az=bilinear(b,a,fs);nd,wdc=buttord(wpz,
2、wsz,rp,as);bd,adz=butter(nd,wdc);hk=freqz(bd,adz)subplot(2,2,1)plot(abs(hk)xlabel(Hz); ylabel( 幅度); title(幅度函数曲线)subplot(2,2,2)plot(angle(hk)xlabel(omega/pi); ylabel(phi(omega); title(相频特性曲线) FIR数字滤波器的设计n,wn,bta,ftype=kaiserord(0.3 0.45 0.65 0.8,0 1 0,0.01 0.1087 0.01); h1=fir1(n,wn,ftype,kaiser(n+1,bta),noscale); hh1,w1=freqz(h1,1,256); figure(1) subplot(2,1,1) plot(w1/pi,20*log10(abs(hh1) grid xlabel(归一化频率w);ylabel(幅度/db); subplot(2,1,2) plot(w1/pi,angle(hh1) grid xlabel(归一化频率w);ylabel(相位/rad);