?? butter_an.m
字號(hào):
% Name: butter_an
% This program is used to design the Butterworth lowpass filter
% The specifications of the filter are:
% Rp: The maximal passband attenuation in dB
% Rs: The minimum stopband attenuation in dB
% wp: The passband cutoff frequency
% ws: The stopband cutoff frequency
% N: The order of the lowpass filter
clear,close all,
format short
Rp=3;%input('Type in the data ap=:');
Rs=25;%input('Type in the data as=:');
wp=500*2*pi;
ws=900*2*pi;
%==========================================================================
ksp=sqrt((10^(0.1*Rp)-1)/(10^(0.1*Rs)-1));
lamdsp=ws/wp;
N=ceil(-log(ksp)/log(lamdsp));
omegac=ws*(10^(0.1*Rs)-1)^(-1/(2*N));
fprintf('\n***The order N of Butterworth is %2.0f\n',N);
%===========================================================================
wn=wp/(2*pi);
[z,p,k]=buttap(N);
[b,a]=zp2tf(z,p,k);
%==========================================================================
ba=b;aa=a;
for m=1:N;
aa(m+1)=a(m+1)*omegac^(m);
ba(m+1)=b(m+1)*omegac^(m);
end
ba
aa
%==========================================================================
[h,w]=freqs(ba,aa);
subplot(211)
plot(w/(2*pi),abs(h))
axis([0,2000,0,1.2])
grid on,title('The frequency response of 5-th order Butterworth lowpass filter')
xlabel('Frequency f in Hz')
subplot(223)
impulse(ba,aa)
subplot(224)
step(ba,aa)
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -