How should I make a Bode Plot of a Multiple Input and multiple Output System
Afficher commentaires plus anciens
I have a simulink file with two outports and two inports. What is wrong with my m-file below?
[A,B,C,D] = linmod('SimFileName');
wmin = 1; nmax = 5; Npoints = 200;
w = logspace(wmin,wmax,Npoints);
system = ss(A,B,C,D);
[mag,phase] = bode(system,w);
for k=1:Npoints
magdBout1in1 = 20*log10(mag(1:1:k));
magdBout2in1 = 20*log10(mag(2:1:k));
phaseOut1in1 = phase(1:1:k);
phaseOut2in1 = phase(2:1:k);
end
figure(2);clf;
subplot(2,1,1);
loglog(w,magdBout1in1,'-',w,magdBout2in1,'--');grid;
subplot(2,1,2);
semilogx(w,phaseOut1in1,'-',w,phaseOut2in1,'--');grid;|
Réponses (1)
Arkadiy Turevskiy
le 12 Août 2013
There seem to be several things that are wrong. For example:
- You define a variable nmax, but the script is using wmax - looks like it is a typo
- In the for loop body you keep overriding the variables on the left side of the assignment statements
If I understand correctly what you are trying to do, it seems you can do that in a simpler way like this:
bode(system(1,1),w);
hold on;
bode(system(1,2),w,'--');
grid;
HTH.
1 commentaire
Meinrad
le 13 Août 2013
Catégories
En savoir plus sur Time and Frequency Domain Analysis dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!