《实验五 脉冲响应不变法设计IIR数字滤波器.docx》由会员分享,可在线阅读,更多相关《实验五 脉冲响应不变法设计IIR数字滤波器.docx(7页珍藏版)》请在第一文库网上搜索。
1、实验五脉冲响应不变法设计IIR数字滤波器一、实验目的1 .掌握利用脉冲响应不变法设计IIR数字滤波器的原理及具体方法。2 .加深理解数字滤波器和模拟滤波器之间的技术指标转化。3 .掌握脉冲响应不变法设计HR数字滤波器的优缺点及适用范围。二、实验原理1、基本原理从时域响应出发,使数字滤波器的单位脉冲响应h(n)模仿模拟滤波器的单位冲激响应儿,h(n)等于“的取样值。2、变换方法思路:Ha(S)拉氏变换时域采样1%(nT)=h(n)Z变换H(Z)(1)将Ha(s)进行部分分式展开乩(S)=k=S_Pk(2)MHa(s)进行拉式变换ha(t)=W*=(3)对儿时域采样得到h(n)-=MAeP%(仃)
2、=丑A(e%5)k=*=1(4)对h(n)进行z变换(z)=-e玖z3、设计步骤(1)确定数字滤波器的性能指标R”A。(2)将数字滤波器频率指标转换成响应的模拟滤波器频率指标Qff=C二丝(3)根据指标。p,7,RP和A,设计模拟滤波器“(S)。(4)将Ha(s)展成部分分式形式Hok=Pk(5)把模拟极点0转换成数字极点,得到数字滤波器H(Z)=之ZT可见,(s)至H(Z)间的变换关系为11一“方法1:利用residue函数和residuez函数实现脉冲响应不变变换法,实用方法如下:r,p,k=residue(b,a)b,a=residue(r,p,k)实现多项式形式如J-4+%(S)NN-
3、IQNS+aN-s+和部分分式形式H(s)=-+Z(s)之间的装换r,p,k=residuez(b,a)b,a=residuez(r,p,k)实现多项式形式H(Z)=至gya0+a1s+aNs和部分分式形式H(Z)=-1-八I-PIZ1-p2zI-PNZ之间的转换方法2:mat1ab中提供了impinvar函数采用脉冲响应不变法实现模拟滤波器到数字滤波器的变换,其使用如下:bz,az=impinvar(b,a,fs)采用脉冲响应不变法将模拟滤波器系统函数的系数向量b和a变换成为数字滤波器系统函数的系数向量bz和az,fs为采样频率(默认为1)。bz,az=impinvar(b,a)采样频率默认
4、为1的情况下,采用脉冲响应不变法将模拟滤波器变换为数字滤波器。三、实验内容1设采样频率为fsMkHz,采用脉冲响应不变法设计一个三阶巴特沃斯数字低通滤波器,其3dB截止频率为fc=1kHz.实验代码:wn=2*pi*1000;b=wn3;a=12*wn2*wn2wn3;bzaz=impinvar(b,a,4000);w=0:500*pi/500;Hw=freqz(bz,az);subp1ot(221);p1ot(w/pi,abs(H);gridon;x1abe1(omega(pi),);y1abe1(|H(eAjAomega)r);subp1ot(222);p1ot(w/pi,20*1og10
5、(abs(H)max(abs(H);gridOn;XIabeI(omega(pi)y1abe1(H(eAjAomega)(dB);subp1ot(223);p1ot(w/pi,ang1e(H)/pi);gridonx1abe1(omega(pi),)iy1abe1(PhaseofH(eAjAomega)(pi)1);grd=grpde1ay(bz,az,w);subp1ot(224);p1ot(w/pi,grd);gridonjx1abe1(,omega(pi)iy1abe1(,Groupde1ay*);实验结果:p)-()H-.8.6/0.0.CS_(!H-15()O0.51210Ae-Pd
6、no10-1100.5O.5o,50.-O.SI)HJosp-d-1O()()2.设采样频率为fs=10kHz,设计数字低通滤波器,满足如下指标通带截止频率:fp=1kHz,通带波动:Rp=IdB阻带截止频率:fst=1.5kHz,阻带衰减:As=15dB要求分别采用巴特沃斯、切比雪夫I型、切比雪夫口型和椭圆模拟原型滤波器及脉冲响应不变法进行设计。结合实验结果,分别讨论采用上述设计的数字滤波器是否都能满足给定指标要求,分析脉冲响应不变法设计HR数字滤波器的优缺点及适用范围。巴特沃斯模拟原型滤波器设计HR数字滤波器实验代码:wp=1000*2*pi;ws=1500*2*pi;rp=1;as=15
7、;nwn=buttord(wp,ws,rp,as,s,);ba=butter(n,wn,s,);bzaz=impinvar(b,a,10000);w=0:500*pi/500;Hw=freqz(bz,az);subp1ot(221);p1ot(w/pi,abs(H);gridon;x1abe1(omega(pi),);y1abe1(|H(eAjAomega)r);subp1ot(222);p1ot(w/pi,20*1og10(abs(H)max(abs(H);gridon;x1abe1(omega(pi),);y1abe1(|H(eAjAomega)|(dB);subp1ot(223);p1o
8、t(w/pi,ang1e(H)/pi);gridon;x1abe1(omega(pi);y1abe1(PhaseofH(eAjAomega)(pi),);grd=grpde1ay(bz,az,w);subp1ot(224);p1ot(w/pi,grd);gridon;x1abe1(omega(pi)r);y1abe1(Groupde1ay);实验结果:Ooooo 2 4 6 8一 . (COp)=-一O 5 O6)H-()(.5m O(OO0.515O1aepdno0O0.5-SI)HOOseud()(i)切比雪夫I型模拟原型滤波器设计HR数字滤波器实验代码:wp=1000*2*pi;ws=1
9、500*2*pi;p=1;as=15;nwn=cheb1ord(wp,ws,rp,as,s);ba=cheby1(n,rp,wns,);bzaz=impinvar(b,a,10000);w=0:500*pi/500;Hw=freqz(bz,az);subp1ot(221);p1ot(w/pi,abs(H);gridon;x1abe1(omega(pi),);y1abe1(|H(eAjAomega)r);sub1ot(222);p1ot(w/pi,20*1og10(abs(H)max(abs(H);gridon;x1abe1(,omega(pi);y1abe1(|H(eAjAomega)|(dB
10、y);subp1ot(223);p1ot(w/pi,ang1e(H)/pi);gridonix1abe1(,omega(pi),)iy1abe1(PhaseofH(eAjAomega)(pi)1);grd=grpde1ay(bz,az,w);subp1ot(224);p1ot(w/pi,grd);gridonix1abe1CXomegaCXpi)1);y1abe1(,Groupde1ay);实验结果:1.5_13飞H0.5000.5()0-20-40-601-80100.5()151050.5()10.50-0.5-100.5()切比雪夫II型模拟原型滤波器设计IIR数字滤波器实验代码:wp=
11、1000*2*pi;ws=1500*2*pi;rp=1;as=15;nwn=cheb2ord(wp,ws,rp,as,s,);ba=cheby2(n,as,wn,s,);bzaz=impinvar(b,a,10000);w=0:500*pi/500;Hw=freqz(bz,az);subp1ot(221);p1ot(w/pi,abs(H);gridon;x1abe1(omega(pi),);y1abe1(|H(eAjAomega)r);subp1ot(222);p1ot(w/pi,20*1og10(abs(H)max(abs(H);gridon;X1abe1Comega(pi);y1abe1(
12、|H(eAjAomega)|(dB);subp1ot(223);p1ot(w/pi,ang1e(H)/pi);gridonjx1abe1(,omega(pi),)iy1abe1(,PhaseofH(eAjAomega)(piy);grd=grpde1ay(bz,az,w);subp1ot(224);p1ot(w/pi,grd);gridon;x1abe1(omega(pi);y1abe1(Groupde1ay);实验结果:1.5ra)H_OO1505。OSO)HOSEqd.55m0.(-O0.5-5p)f)H一-5O0.5()()椭圆模拟原型滤波器设计I1R数字滤波器实验代码:wp=1000*
13、2*pi;ws=1500*2*pi;rp=1;as=15;nwn=e11ipord(wp,ws,rp,as,s,);fba=e11ip(n,rp,as,wn,s,);bzaz=impinvar(b,a,10000);w=0:5001*pi/500;Hw=freqz(bz,az);subp1ot(221);p1ot(w/pi,abs(H);gridon;x1abe1(omega(pi),);y1abe1(|H(eAjAomega)r);subp1ot(222);p1ot(w/pi,20*1og10(abs(H)max(abs(H);gridon;XIabeI(omega(pi)y1abe1(H(eAjAomega)(dB);subp1ot(223);p1ot(w/pi,ang1e(H)/pi);gridonjx1abe1(omega(pi),)jy1abe1(PhaseofH(eAjAomega)(piy);grd=grpde1ay(bz,az,w);subp1ot(224);p1ot(wpi,grd);gridoix1abe1(omega(pi),)iy1abe1(Groupde1ay);实验结果:1.55O O 1 2 - - mp)rH_O0.5AE-pdnoo15 0 531)HJo SBqd-1-5