发布网友 发布时间:2022-05-23 23:00
共1个回答
热心网友 时间:2024-03-09 21:41
wp=2*pi*6000;ws=2*pi*12000; rp=3; as=25; dispf=14; dispa=-90;grid on;axis([0,dispf,dispa,5]);[n,wc]=buttord(wp,ws,rp,as,'s');[B,A]=butter(n,wc,'s');k=0:511;fk=0:14000/512:14000;wk=2*pi*fk;Hk=freqs(B,A,wk);[n1,wp1]=cheb1ord(wp,ws,rp,as,'s');[B1,A1]=cheby1(n1,rp,wp1,'s');k=0:511;fk=0:14000/512:14000;wk=2*pi*fk;Hk1=freqs(B1,A1,wk);[n2,wp2]=cheb2ord(wp,ws,rp,as,'s');[B2,A2]=cheby2(n2,as,wp2,'s');k=0:511;fk=0:14000/512:14000;wk=2*pi*fk;Hk2=freqs(B2,A2,wk);[n3,wp3]=ellipord(wp,ws,rp,as,'s');[B3,A3]=ellip(n3,rp,as,wp3,'s');k=0:511;fk=0:14000/512:14000;wk=2*pi*fk;Hk3=freqs(B3,A3,wk);plot(fk/1000,20*log10(abs(Hk)),fk/1000,20*log10(abs(Hk1)),':',fk/1000,20*log10(abs(Hk2)),'--',fk/1000,20*log10(abs(Hk3))); xlabel('频率(kHz)','FontSize',16,'FontWeight','bold'); ylabel('幅度(dB)','FontSize',16,'FontWeight','bold'); title('4种滤波器性能比较','FontSize',16,'FontWeight','bold'); legend('巴特沃兹滤波','切比雪夫I滤波','切比雪夫II滤波','椭圆滤波','Location', 'East')grid;