Bode diagram for a Butterworth filter
72 次查看(过去 30 天)
显示 更早的评论
Hi,
I want help in doing a Bode diagram for a 8th order Butterworth passband with passband between 2 and 12 Hz. Sampling frequency of 60 Hz,
Can you help?
Thank you!
0 个评论
回答(2 个)
Jon
2022-7-28
What specific problems or errors are you getting? Here is an example that maybe you can adapt to your situation
fs = 1000; % sampling frequency Hz
fn = fs/2; % Nyquist frequency Hz
fp = [2,12] % passband Hz
fpn = fp/fn % normalized passband (fraction of Nyquist Frequency)
N = 8; % filter order
% calculate butterwork filter
[A,B,C,D] = butter(N,fpn,"bandpass")
% define linear system
sys = ss(A,B,C,D,1/fs);
% make bode plot
bode(sys)
0 个评论
Star Strider
2022-7-28
Fs = 60; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
[z,p,k] = butter(8, [2 12]/Fn); % Design Filter, Return [Zero, Pole, Gain] Output
[sos,g] = zp2sos(z,p,k); % Convert To Second-Order-Section Representation For Stability
figure
freqz(sos, 2^16, Fs) % Plot Filter Bode Plot
A better way to determine the filter order is to begin with the buttord funciton, since it allows other arguments (for example the stopband limits and and stopband attenuation) to be defined as well. (I generally prefer elliptic filters, since they are computationally more efficient.)
.
2 个评论
Jon
2022-7-28
So I guess if you have the signal processing toolbox but not the control system toolbox this would be an alternative. If the OP has the control system toolbox, is there any reason not to use bode (as I outlined previously)
Star Strider
2022-7-28
Convenience.
The freqz function requires only the code necessary to call it with the zp2sos output. No other code is required.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Digital Filter Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!