how to plot multiple bode plots in one figure ?

조회 수: 109 (최근 30일)
Aniket
Aniket 2013년 4월 25일
편집: Bal Krishna Poudel 2015년 5월 3일
Hi,
I am using matlab/simulink 2012. Is there any way to plotting several bode diagrams into same figure. For example i have system with parameters and i am using generating gain in matlab file and using this gain in simulink model. I do a bode plot for parameters and then i changes some parameters in matlab file again generating gain and again do bode plot using bode block in simulink.
but for comparison reasons i would like those two plots in same figure. how should i do this ?
Thank you
  댓글 수: 1
Bal Krishna Poudel
Bal Krishna Poudel 2015년 5월 3일
편집: Bal Krishna Poudel 2015년 5월 3일
Hi Aniket,
Each time when you simulate the frequency response in simulink using linearization tool, systems named linsys1, linsys2, linsys3 etc. will be created in the linear analysis workspace. Simply drag these systems in to the MATLAB workspace located just above the linear analysis tool. Then, go to the command window and write;
bode(linsys1); hold on; bode(linsys2); hold on; bode(linsys3); and so on.
you will get bode plot of all the systems(linsys1, linsys2, linsys3 etc.) in the same axes.

댓글을 달려면 로그인하십시오.

채택된 답변

Arkadiy Turevskiy
Arkadiy Turevskiy 2013년 4월 25일
When you open the dialog for Bode Plot block, the third tab, called "logging" lets you save the linear system into MATLAB workspace.
Once you have the system in MATLAB workspace you can just use bode command to plot multiple systems on the same plot, i.e.,
bode(sys1),
hold on;
bode(sys2,'r');
  댓글 수: 2
Aniket
Aniket 2013년 4월 25일
I have done as you are saying but its showing me error of "not enough arguments" and the at matlab workspace when i am saving data its saving in structure format and it contains time , values and block name.
for error i have tried to give arguments like frequency ,
so i declare frequency
w = 2*pi*(0:500)
bode (sys1,w)
but this also gives me error
""Invalid syntax for the "tf" command. Type "help tf" for more information.
Error in bode (line 96) sys = tf(a,b);""
my model is follwing blocks
Arkadiy Turevskiy
Arkadiy Turevskiy 2013년 4월 26일
For the model you get from Simulink you need to do
bode(sys.values)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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