程序5-2wp=0.5;ws=0.6;Rp=1;As=50;[N,wc]=buttord(wp,ws,Rp,As);[B,A]=butter(N,wc);k=0:511;fk=0:2000/512:2000;wk=2*pi*fk;HK=freqs(B,A,wk);subplot(2,2,1);plot(fk,20*log10(abs(HK)));gridonxlabel('频率Hz');ylabel('幅度db')axis([0,10,-110,110])仿真图程序5-3wp=[0.50.8];ws=[0.60.7];Rp=0.1;As=50;[n,wpo]=ellipord(wp,ws,Rp,As);[B,A]=ellip(n,Rp,As,wpo);%k=0:511;fk=0:2000/512:2000;freqz(B,A,512,2);subplot(2,1,1);gridonxlabel('f');ylabel('A');axis([0.7,1.3-100,10]);仿真图程序5-4:Fp=150;%通带截止频率Fs=100;%阴带截止频率Ap=1;%通带最大衰减As=40;%阻带最小衰减Ft=1000;%抽样频率Wp=2*pi*Fp/Ft;Ws=2*pi*Fs/Ft;[N,Wn]=cheb2ord(Wp,Ws,Ap,As,'s');[z,p,k]=cheb2ap(N,39)[b,a]=zp2tf(z,p,k);[BT,AT]=lp2hp(b,a,Ws);[num,den]=bilinear(BT,AT,1)disp('分子系数:');disp(num);disp('分母系数:');disp(den);[h,w]=freqz(num,den);figure;plot(w*Ft/(2*pi),abs(h));grid;%绘制切比雪夫高通滤波器幅频特性xlabel('omega/\pi');ylabel('增益/dB');title('切比雪夫高通滤波器');f1=500;f2=50;t=0:0.001:0.15;x1=sin(pi*f1*t);x2=cos(pi*f2*t);x=x1+x2;figure;subplot(2,1,1);plot(x(1:150));y1=fft(x,256)f=1000*(0:127)/256;subplot(2,1,2)plot(f,abs(y1(1:128)));axis([0100*pi080]);figure;subplot(2,1,1)plot(x);gridon;axis([0,500*pi,-3,3]);xlabel('t');ylabel('x(t)');title('输入信号x的波形')y=filter(num,den,x);%数字滤波器输出subplot(2,1,2);%绘制输出y的波形plot(y);gridon;xlabel('t');ylabel('y');title('滤波器输出y的波形');仿真图:高通切比雪夫2型滤波器信号的150个样本点时域与频域图通过滤波器前后的信号图