📄 iir_butt_design.m
字号:
% Name: iir_butt_design
% This program is used to design the IIR digital lowpass filter
% using the bilinear transformation
% The analog lowpass filter is the Butterworth
% The specifications of the digital filter are:
% alphap: The maximal passband attenuation in dB
% alphas: The minimum stopband attenuation in dB
% wp: The passband cutoff frequency
% ws: The stopband cutoff frequency
% N: The order of the lowpass filter
clear
format short
alphap=1;%input('Type in the data ap=:');
alphas=15;%input('Type in the data as=:');
wp=0.01*pi;%input('Type in the passband cutoff frequency wp=:');
ws=0.02*pi;%input('Type in the stopband cutoff frequency ws=:');
T=1;
omegap=(2/T)*tan(wp/2);
omegas=(2/T)*tan(ws/2);
%==========================================================================
omegac=omegap;
omegar=omegas/omegap;
N=ceil((log10((10^(alphap/10)-1)/(10^(alphas/10)-1)))/(2*log10(omegap/omegas)));
fprintf('\n***The order N of Butterworth is %2.0f\n',N);
%===========================================================================
wn=wp/pi;
[b,a]=butter(N,wp);
fprintf('\n***The coefficient vectors of Type-I Chebyshev are %2.0f\n');
b
a
%==========================================================================
[H,w]=freqz(b,a);
%=================================================================
subplot(211)
plot(w/pi,abs(H));
title('Amplitude response'),ylabel('|H|'),axis([0,1,0,1.1]),
grid on
subplot(212)
plot(w/pi,20*log(abs(H)));
ylabel('dB'),axis([0,1,-80,0]),
xlabel('Frequency (pi)'),grid on
%==========================================================================
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -