資源描述:
《源程序 數(shù)字信號處理課程設計》由會員上傳分享,免費在線閱讀,更多相關內容在教育資源-天天文庫。
1、1IIR數(shù)字巴特沃思濾波器設計(沖激不變法)functionIIR_Imp%%ImpulseInvarianceTransformation%ButterworthLowpassFilterDesign%wp=0.2*pi;ws=0.3*pi;Rp=1;As=15;T=1;OmegaP=wp*T;OmegaS=ws*T;ep=sqrt(10^(Rp/10)-1);Ripple=sqrt(1/(1+ep*ep));Attn=1/(10^(As/20));%%AnalogButterworthPrototypeFilterCalculation[cs,ds]=af
2、d_butt(OmegaP,OmegaS,Rp,As);[b,a]=imp_invr(cs,ds,T);[C,B,A]=dir2par(b,a);%figure(1);[db,mag,pha,grd,w]=freqz_m(b,a);subplot(2,2,1);plot(w/pi,mag);title('MagnitudeResponse');xlabel('1frequencyinpiunits');ylabel('/H/');axis([0,1,0,1.1]);set(gca,'XTickMode','manual','XTick',[0,0.2,0.3,
3、1]);set(gca,'YTickMode','manual','YTick',[0,Attn,Ripple,1]);grid;subplot(2,2,3);plot(w/pi,db);title('MagnitudeindB');xlabel('2frequencyinpiunits');ylabel('decibels');axis([0,1,-40,5]);set(gca,'XTickMode','manual','XTick',[0,0.2,0.3,1]);set(gca,'YTickMode','manual','YTick',[-50,-15,-
4、1,0]);grid;set(gca,'YTickLabelMode','manual','YTickLabels',[50,15,1,0]);subplot(2,2,2);plot(w/pi,pha/pi);title('PhaseResponse');xlabel('3frequencyinpiunits');ylabel('piunits');axis([0,1,-1,1]);set(gca,'XTickMode','manual','XTick',[0,0.2,0.3,1]);set(gca,'YTickmode','manual','YTick',[
5、-1,0,1]);grid;subplot(2,2,4);plot(w/pi,grd);title('GroupDelay');xlabel('4frequencyinpiunits');ylabel('Samples');axis([0,1,0,10]);set(gca,'XTickMode','manual','XTick',[0,0.2,0.3,1]);set(gca,'YTickMode','manual','YTick',[0:2:10]);grid;2IIR數(shù)字巴特沃思濾波器設計(雙線性變換法)functionIIR_BIL%%利用雙線性法設計Bu
6、tterworth數(shù)字濾波器%wp=0.2*pi;ws=0.3*pi;Rp=1;As=15;T=1;Fs=1/T;OmegaP=(2/T)*tan(wp/2);OmegaS=(2/T)*tan(ws/2);ep=sqrt(10^(Rp/10)-1);Ripple=sqrt(1/(1+ep*ep));Attn=1/(10^(As/20));%[cs,ds]=afd_butt(OmegaP,OmegaS,Rp,As);[b,a]=bilinear(cs,ds,T);[C,B,A]=dir2cas(b,a);figure(1);[db,mag,pha,grd,w]=
7、freqz_m(b,a);subplot(2,2,1);plot(w/pi,mag);title('MagnitudeResponse')xlabel('frequencyinpiunits');ylabel('
8、H
9、');axis([0,1,0,1.1])set(gca,'XTickMode','manual','XTick',[0,0.2,0.3,1]);set(gca,'YTickMode','manual','YTick',[0,Attn,Ripple,1]);gridsubplot(2,2,3);plot(w/pi,db);title('Magnit
10、udeindB');xlabel('f