冲激响应不变法设计巴特沃斯低通数字滤波器

来源:百度知道 编辑:UC知道 时间:2024/05/31 06:00:11
频率小于5kHz的通带内,幅度特性下降小于3dB;频率大于12kHz的阻带内,衰减大于15dB,采样频率为30kHz.

改一下参数即可
% specifications are given as: wpc=0.2*pi radians,
% alpha_p=1 dB, wsc=0.3*pi radians and alpha_s=15 dB.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Specifications for the digital filter
wpc=0.2*pi;
wsc=0.3*pi;
Ap=1;
As=15;
% Determination of the parameters of the Butterworth lowpass
% analog prototype filter
Td=1;
Wpc=wpc/Td;
Wsc=wsc/Td;
N=ceil((log10((10^(Ap/10)-1)/(10^(As/10)-1)))/(2*log10(Wpc/Wsc)))
Wc=Wpc/((10^(Ap/10)-1)^(1/(2*N)))
% Determination of the transfer function Ha(s)
[B,A]=butter(N,Wc,'s')
% Impulse invariance transformation from Ha(s) to H(z)
[b,a] = impinvar(B,A);
% Determination of the frequency response of the digital filter
[H,w] = freqz(b,a);
% Plot the magnitude and phase responses of the digital filer.
mag=abs(H);
phase=angle(H);
phase_deg=(phase/pi)*180;
subplot(2,2,1);
plot(w/pi,mag);