?? iir_che_design.m
字號(hào):
% Name: iir_che_design
% This program is used to design the IIR digital lowpass filter
% using the bilinear transformation
% 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=10;%input('Type in the data as=:');
wp=0.2*pi;%input('Type in the passband cutoff frequency wp=:');
ws=0.3*pi;%input('Type in the stopband cutoff frequency ws=:');
T=0.001;
omegap=(2/T)*tan(wp/2);
omegas=(2/T)*tan(ws/2);
%==========================================================================
ep=sqrt(10^(0.1*alphap)-1);
A=10^(alphas/20);
omegac=omegap;
omegar=omegas/omegap;
g=sqrt(A*A-1)/ep;
N=ceil(log10(g+sqrt(g*g-1))/log10(omegar+sqrt(omegar*omegar-1)));
fprintf('\n***The order N of Type-I Chebyshev is %2.0f\n',N);
%===========================================================================
wn=wp/pi;
[b,a]=cheby1(N,alphap,wn);
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
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -