Bode Plot Axis Change

Hello Im trying to learn the bode plot tool
Here is what i have
Here is my tf function Am i inputting it correct? The plot is not correct (.001*S)/(.0000005S^2 + .0017*s +1)
num = [.001];
denom = [ .0000005, .0017, 1];
g = tf(num, denom);
bode(g),grid
I get a nice bode plot from this however the max magnitude is not where its suppose to be on the plot. It is self scaling to -60dB I need to change the scale somehow to see what is going on at -4 dB for example.
Can someone help please?

 Accepted Answer

Robert
Robert on 23 Jul 2015

0 votes

All, i figured out my issue and maybe this will help someone in the future.
My numerator has the highest power of S as the 1st power. You must include all the powers of S all the way down to S to the zero power. There for the numerator vector must have a zero for the second component This solved my issue and the scaling is now correct also

More Answers (1)

First of all your numerator is not well settled
num=[0.001 0];
That mistake will be ignored. Unfortunately there's not an easy way to fix the axis limits using the bode command. However, there's a simply code that may be useful.
close all;
num=0.001;
den=[5e-7 0.0017 1];
g=tf(num,den);
opts1=bodeoptions('cstprefs');
opts1.PhaseVisible = 'off';
opts1.YLim={[-140 -50]};
Mag=subplot(2,1,1);bodeplot(g,opts1); grid on;
set(xlabel(''),'visible','off');
opts2=bodeoptions('cstprefs');
opts2.MagVisible = 'off';
opts2.YLim={[-180 0]};
Phase=subplot(2,1,2);bodeplot(g,opts2); grid on; title('');
Referring to the lines of the code, you may be able to change the Magnitud and Phase, in this example [-140 50] and [-180 0] are good options.
opts1.YLim={[-140 -50]};
opts2.YLim={[-180 0]};
I advice to previously plot the Bode Diagram to determine these values and change them as you wish. The final result looks like.

1 Comment

Beginning in R2024b, the chart object returned by the "bodeplot" command can be modified directly using its properties.
For example,
num=0.001;
den=[5e-7 0.0017 1];
g=tf(num,den);
bp = bodeplot(g);
bp.PhaseVisible = 'off';
bp.YLimits = [-140 -50];

Sign in to comment.

Categories

Asked:

on 23 Jul 2015

Commented:

on 14 Nov 2025

Community Treasure Hunt

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

Start Hunting!