How to plot a bode graph for a filtered output?
4 views (last 30 days)
Show older comments
Utsang Dhungel
on 7 Dec 2021
Commented: Star Strider
on 8 Dec 2021
So I have a IIR butterworth filter with coeffficient converted into its transfer function, [b a]=sos2tf(SOS,G). I have a input audio file that I am using this filter on, and I did y = fitler(b,a,x), but now I am confused as to how I can plot the magnitude and frequency of this output?. I am also lacking theoritical knowledge on this subject which has made it hard for me to understand this.
0 Comments
Accepted Answer
Star Strider
on 7 Dec 2021
‘... coeffficient converted into its transfer function, [b a]=sos2tf(SOS,G).’
Do not do that! Keep it as a second-order-section realisation for best results and greatest stability.
‘y = fitler(b,a,x)’
Do not do that, either. Use the filtfilt function instead, since its results are phase-neutral (no phase distortion).
Use the fft function to calculate the frequency-domain (spectrum) representation of the output. Plot the magnitude using the absolute (abs) value, and the phase using the angle function.
The documentation for those functions go into extensive detail as to how to use them, so I will not describe them further here.
.
6 Comments
Star Strider
on 8 Dec 2021
Yes, exactly.
To illustrate —
fHz = linspace(0, 44100/2, 11);
fHz(1:6)
fHz(7:11)
fradsec = (fHz * pi)/max(fHz);
fradsec(1:6)
fradsec(7:11)
.
More Answers (0)
See Also
Categories
Find more on Digital Filter Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!