- Do you receive warning and/or error messages? If so the full and exact text of those messages (all the text displayed in orange and/or red in the Command Window) may be useful in determining what's going on and how to avoid the warning and/or error.
- Does it do something different than what you expected? If so, what did it do and what did you expect it to do?
- Did MATLAB crash? If so please send the crash log file (with a description of what you were running or doing in MATLAB when the crash occured) to Technical Support using the Contact Support link on the Support section of the MathWorks website so we can investigate.
line 15 does not work
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
clear all, close all
m1 = 10;
m2 = 350;
kw = 500000;
ks = 10000;
Bd = [ 1000 2000 3000 4000 ];
t = 0:0.01:2;
for i = 1:4
b = Bd(i);
num = kw*b/(m1*m2)*[1 ks/b];
den =[1 (b/m1+b/m2) (ks/m1+ks/m2+kw/m1) (kw*b/(m1*m2)) (kw*ks/(m1*m2))];
sys=tf(num,den);
y =step(sys, t );
subplot(2,2,i);
plot( t,y(:,1), '-',t,y(:,2),':');
legend('wheel','car')
ttl=sprintf('Response with b = %.0f',b);
title(ttl);
end
1 Commento
Steven Lord
il 8 Apr 2021
Which line is line 15? Don't make us guess or count, tell us.
What does "does not work" mean?
Risposta accettata
David Hill
il 8 Apr 2021
If you inspect your variables before plotting, you will find that y is a single column.
plot(t,y,'-');%this will work in your current code, but you were expecting plots for wheel and car and are only getting one.
0 Commenti
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!