📄 p5_17_pre.m
字号:
%Program ZouyxLabExeSheet_2_Pre
%Program to Compute the Order of the Butterworth Lowpass Filter
%
%Type in the passband edge frequency and the stopband edge frequency
Fp=input('Passband edge frequency in Hz = ');
Fs=input('Stopband edge frequency in Hz = ');
%Type in the peak passband ripple and the minimum stopband attenation
Rp=input('Peak passband ripple in dB = ');
Rs=input('Minimum stopband attenation in dB = ');
Wp=2*pi*Fp;
Ws=2*pi*Fs;
%Compute the transition ratio
k=Wp/Ws;
%Compute the discrimination parameter
e=sqrt(1/(10.^(-Rp/10))-1);
A=sqrt(1/(10.^(-Rs/10)));
k1=e/sqrt(A.^2-1);
%Compute the order
N=log10(1/k1)/log10(1/k);disp(N)%N=3.3683
%Compute the 3-dB cutoff frequency
Wn=Ws/((A.^2-1).^(1/(2*ceil(N))));disp(Wn/(2*pi))%Fn=3.374kHz
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -