Bode diagram for a Butterworth filter
70 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (2)
Jon
am 28 Jul. 2022
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 Kommentare
Star Strider
am 28 Jul. 2022
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 Kommentare
Jon
am 28 Jul. 2022
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
am 28 Jul. 2022
Convenience.
The freqz function requires only the code necessary to call it with the zp2sos output. No other code is required.
Siehe auch
Kategorien
Mehr zu Digital Filter Analysis finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!