multiple bode plots on same graph

조회 수: 373 (최근 30일)
aaa
aaa 2011년 12월 14일
답변: mjcStudent 2019년 4월 3일
Hi,
Does anyone know how to plot multiple bode plots using the "bode" function? I know that the easiest way to do this would be to use
bode(sys1, sys2)
but this assumes that both of these functions are written in the "tf" form.
The problem i am having is that I would like to plot an array of data, with a 'tf' data on the same plot. However, I can't quite get it to work the way i want.
So what i want is to plot the bode plot first
bode(A)
and then be able to plot the magnitude and phase in the corresponding bode figure which uses the code
semilogx(f, data(:,1))
semilogx(f,data(:,2))
for the magnitude.
has anyone done this before?
tia
  댓글 수: 3
Janamejaya
Janamejaya 2012년 7월 30일
I was able to solve the problem, a Prof. at my university helped me.
Here's the code.
semilogx([10 100 200 300 400 500 600 700 800 900 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 ], [2 2.3 13.3 26.3 -6.46 -11.7 -15.6 -18.8 -20.9 -23.4 -25.2 -37.9 -44.8 -50 -53.9 -57 -59.6 -62 -64 -65 ]);
hold on
num=[0 1];
den=[0.000000495 0.000033 1];
system1=tf(num,den);
bode(system1)
best wishes
janmay

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

답변 (5개)

a a
a a 2015년 11월 9일
편집: a a 2015년 11월 9일
It's working for me:
figure(1);
hold on;
bode(W1); %here you need a system or transfer function or space-state model, etc..
bode(W2);
hold off;

Paulo Silva
Paulo Silva 2011년 12월 14일
Maybe something with hold on?!
g = tf([1 0.1 7.5],[1 0.12 9 0 0]);
bode(g)
hold on
g = tf([1],[1 0.12 9 0 0]);
bode(g)

aaa
aaa 2011년 12월 14일
unfortunately it is not that simple. my code looks more like
g = tf([1 0.1 7.5],[1 0.12 9 0 0]);
bode(g)
hold on
semilogx(f, data)
the way you have done it assumes both plots are using 'tf'm which could also be plotted just with
bode(g1,g2)
  댓글 수: 1
Patricia Darling
Patricia Darling 2016년 3월 1일
I have the same question, none of these answers seem to address the issue of having two different types of data sets on the same bode plot. Did you ever resolve this?

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


Craig
Craig 2011년 12월 16일
You can create an frd object from your data and then plot it like any other LTI object.
[ResponseData,Frequencies]=freqresp(5*tf(1,[1,1,1])); % Example Data
sys1 = tf(1,[1,1]);
sys2 = frd(ResponseData,Frequencies)
bode(sys1,sys2)

mjcStudent
mjcStudent 2019년 4월 3일
For my assignment, I had to plot the same graph with different values of one parameter. I wrote this:
for N = 1: .5 : 3 % 6 values
Jl = .002*N; % the parameter to be changed
% skipping most of code
if N == 1 % only create one figure window on the first iteration
figure
hold on % only turn on 'hold' on the first iteration
end % end if
bode(sys); % plot output
grid
title("Stiffness: MA controller");
end % end for loop
hold off
Produces the following output:
outputImage.png

카테고리

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