1-2基于Butterworth模拟滤波器原型,使用双线性状换设计数字滤波器:各参数值为:通带截止频率Omega=*pi,阻带截止频率Omega=*pi,通带波动值Rp=1dB,阻带波动值Rs=15dB,设Fs=4000Hz。代码:wp=*pi;ws=*pi;Fs=4000;T=1/Fs; OmegaP=(2/T)*tan(wp/2);OmegaS=(2/T)*tan(ws/2);rp=1;rs=15;as=15;ripple=10^(-rp/20);attn=10^(-rs/20);[n,wn]=buttord(OmegaP,OmegaS,rp,rs,'s');[z,p,k]=Buttap(n);[b,a]=zp2tf(z,p,k);[bt,at]=lp2lp(b,a,wn);[b,a]=bilinear(bt,at,Fs);[db,mag,pha,grd,w]=freqz_m(b,a);%%下面绘出各条曲线subplot(2,2,1);plot(w/pi,mag);title('Magnitude Frequency幅频特性');xlabel('w(/pi)');ylabel('|H(jw)|');axis([0,1,0,]);set(gca,'XTickMode','manual','XTick',[0 1]);set(gca,'YTickMode','manual','YTick',[0 attn ripple 1]);gridsubplot(2,2,2);plot(w/pi,db);title('Magnitude Frequency幅频特性(db)');xlabel('w(/pi)');ylabel('dB');axis([0,1,-30,5]);set(gca,'XTickMode','manual','XTick',[0 1]);set(gca,'YTickMode','manual','YTick',[-60 -as -rp 0]);gridsubplot(2,2,3);plot(w/pi,pha/pi);title('Phase Frequency相频特性');xlabel('w(/pi)');ylabel('pha(/pi)');axis([0,1,-1,1]);set(gca,'XTickMode','manual','XTick',[0 1]);gridsubplot(2,2,4);plot(w/pi,grd);title('Group Delay群延时');xlabel('w(/pi)');ylabel('Sample');axis([0,1,0,15]);set(gca,'XTickMode','manual','XTick',[0 1]);grid