1、MATLAB示例
2、MATLAB代码历程
MATLAB 巴特沃斯滤波器
clear all;
fp=3500; fs=5500; Rp=2.5; Rs=25;
[n,fn] =buttord(fp,fs,Rp,Rs,'s');
Wn=2*pi*fn;
[b, a] =butter (n,Wn,'s');
f=0:100:10000;
s=j*2*pi*f;
Hs=polyval(b,s)./polyval(a,s);
figure(1);
subplot (2,1,1);
plot(f, 20*log10(abs(Hs)));
axis([0 10000 -40 1]);
xlabel('频率Hz') ; ylabel('幅度dB');
grid on;
subplot (2,1,2); plot(f,angle(Hs));
xlabel('频率Hz'); ylabel('相角rad');
disp('滤波器阶数和截止频率:')
grid on;
n, fn, Wn, b, a