Bode diagram for a Butterworth filter
45 ビュー (過去 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!