📄 bufferworth.m
字号:
format short e;
disp('*****Input the parameters of Butterworth filter expected*****');
f1 = input (' passband edge(Hz): ');
f2 = input (' stopband edge(Hz): ');
k1 = input (' passband gain(dB) : ');
k2 = input (' stopband attenuation(dB): ');
w1 = 2*pi*f1;
w2 = 2*pi*f2;
N=ceil((log10((10^(-k1/10)-1)/(10^(-k2/10)-1)))/(2*log10(w1/w2)));
disp('***Bufferworth filter order N***:'), disp(N);
Wc = w1/(10^(-k1/10)-1)^(1/(2*N));
k = 0 : N-1;
p = exp(j*pi/2+j*pi*(2*k+1)/(2*N));
disp('***Poles of the norminized transfer function***'), disp(p(:));
p = p*Wc;
disp('***Poles of the real transfer function***'), disp(p(:));
%Derect transfer function form
k = 1*Wc^N; %k is the gain coeciffient
b = real(poly(p)); %b is the denominator polynomial coefficients of Hn(s)
a = zeros(1,N+1); %a is the numerator polynomial coefficients of Hn(s)
a(N+1)=k;
disp('***ai=numerator polynomial coefficients of DIRECT-form in s-plane***'), disp(a(:));
disp('***bi=denominator polynomial coefficients of DIRECT-form in s-plane***'), disp(b(:));
H=tf(a, b);
bode(H,{0.1, 10000*2*pi})
grid on
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -