⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 butter_an.m

📁 经典《信号与系统》教程的matlab例程,对深入理解信号与系统相关概念有很大帮助
💻 M
字号:
% 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)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -