Bode Plot Axis Change

370 次查看(过去 30 天)
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?

采纳的回答

Robert
Robert 2015-7-23
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

更多回答(1 个)

Jonathan Espín Martin
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.

类别

Help CenterFile Exchange 中查找有关 Plot Customization 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by