The magnitude in Bode plot differs from the mag values returned with: [mag,phase,wout] = bode(G,win)

49 views (last 30 days)
Why does the bode plot show a different value in magnitude when compared with the value returned in "mag", in [mag,phase,wout] = bode(G,win)?
%Code where it happened:
num = [67.22,85.48];
den = [0.171,1,0,0];
G = tf(num,den);
[mag,phase,wout]=bode(G,2.74) %The mag value for frequency 2.74 is taken from here. Returns mag = 24.4912.
bode(G) %The magnitude value to compare (stored in the mag variable) is taken visually from the plot. Shows mag = 27.8 (as shown in picture below)
Clearly 24.4912 is different from 27.8. Am I doing something wrong? I'm using Matlab R2019b.
Thank you.

Accepted Answer

Star Strider
Star Strider on 19 Nov 2019
The output magnitudes are not in decibels. If you instead use:
mag_dB = 20*log10(mag)
the result is:
mag_dB =
27.7802
that looks suspicioously like 27.8 dB.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!