用双线性变换法设计切比雪夫II型的数字IIR带通滤波器
用双线性变换法设计切比雪夫II型的数字IIR带通滤波器
用双线性变换法设计原型低通为切比雪夫II型的数字IIR带通滤波器,要求通带边界频率为400Hz,500Hz,阻带边界频率分别为350Hz,550Hz,通带最大衰减1dB,阻带最小衰减40dB,抽样频率为2000Hz,用MATLAB画出幅频特性,画出并分析滤波器传输函数的零极点;
信号x(t)?x(t)?x(t)?sin(2?ft)?sin(2?ft)经过该滤波器,其中f?450Hz,f?600Hz,滤波器的输出y(t)是什么?用Matlab验证你的结论并给出x(t),x(t),x(t),y(t)的图形。
12121212 Matlab 详细设计:
% Design of a Cheb II Bandpass Digital Filter by using bilinear method clc; clear all;
Rp = 1; % bandpass attenuation in dB Rs = 40; % bandstop attenuation in dB OmegaS1_1=350; OmegaS1_2=550; OmegaP1_1=400; OmegaP1_2=500;
Fp=2000; % samling frequency Wp1=2*pi*OmegaP1_1/Fp; Wp2=2*pi*OmegaP1_2/Fp; Ws1=2*pi*OmegaS1_1/Fp; Ws2=2*pi*OmegaS1_2/Fp;
OmegaP1=2*Fp*tan(Wp1/2); % nonlinearlization OmegaP2=2*Fp*tan(Wp2/2); % nonlinearlization OmegaS1=2*Fp*tan(Ws1/2); % nonlinearlization OmegaS2=2*Fp*tan(Ws2/2); % nonlinearlization
OmegaP0=sqrt(OmegaP1*OmegaP2);% equivalent mid frequency Bw=OmegaP2-OmegaP1; % bandwith Eta_P0=OmegaP0/Bw; % Normalization Eta_P1=OmegaP1/Bw; % Normalization Eta_P2=OmegaP2/Bw; % Normalization Eta_S1=OmegaS1/Bw; % Normalization Eta_S2=OmegaS2/Bw; % Normalization
Lemta_P_EquivalentLowPass=Eta_P2/(Eta_P2^2-Eta_P0^2); % change to the
equivalent Lowpass patameter
Lemta_S1_EquivalentLowPass=-Eta_S1/(Eta_S1^2-Eta_P0^2); % change to the equivalent Lowpass patameter
Lemta_S2_EquivalentLowPass=Eta_S2/(Eta_S2^2-Eta_P0^2); % change to the equivalent Lowpass patameter
Lemta_S_EquivalentLowPass=min(Lemta_S1_EquivalentLowPass,Lemta_S2_EquivalentLowPass); % get the smallest % Estimate the Filter Order
[N, Wn]=cheb2ord(Lemta_P_EquivalentLowPass, Lemta_S_EquivalentLowPass, Rp, Rs,'s'); % Design the Filter
[num1,den1]=cheby2(N,Rs,Wn,'s'); [num2,den2]=lp2bp(num1,den1,OmegaP0,Bw); [num,den]=bilinear(num2,den2,Fp); % Compute the gain response w = 0:pi/255:pi; h = freqz(num,den,w); g = 20*log10(abs(h)); % Plot the gain response figure;
plot(w/pi,g);grid axis([0 1 -60 5]);
xlabel('\\omega /\\pi'); ylabel('Gain in dB'); title('Gain Response of a Cheb II Bandpass Filter'); %Plot the poles and zeros [z,p,k]=tf2zp(num,den); figure;
zplane(z,p); %????′?ê?oˉêyá???μ? title('′?ê?oˉêyμ?á???μ?') f1=450;f2=600; t=0:0.0001:1 x1=sin(2*pi*f1*t); x2=sin(2*pi*f2*t); x=x1+x2; figure;
subplot(2,2,1)%????x1μ?2¨D? plot(x1);grid on; axis([0,50*pi,-3,3]); xlabel('t');ylabel('x1(t)'); title('x1μ?2¨D?');
subplot(2,2,2)%????x1μ?2¨D? plot(x2);grid on; axis([0,50*pi,-3,3]); xlabel('t');ylabel('x2(t)');
title('x2μ?2¨D?');
subplot(2,2,3)%????ê?è?xμ?2¨D? plot(x);grid on; axis([0,50*pi,-3,3]); xlabel('t');ylabel('x(t)'); title('ê?è?D?o?xμ?2¨D?') %X=fft(x);
y=filter(num,den,x);%êy×???2¨?÷ê?3? subplot(2,2,4);%????ê?3?yμ?2¨D? plot(real(y)); grid on;
axis([0,50*pi,-3,3]); xlabel('t');ylabel('y'); title('??2¨?÷ê?3?yμ?2¨D?');
测试结果:
图三 实验程序截图
运行结果如下:
Gain Response of a Cheb II Bandpass Filter0-10-20Bdn in ia-30G-40-50-6000.10.20.30.40.50.60.70.80.91? /?传输函数的零极点10.80.60.40.20-0.2-0.4-0.6-0.8-1-1-0.500.51Real Part
Imaginary Part