How to make a while loop to repeat multiple times with different values of variable?
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I would like to repeat my while loop multiple times, each time with different q value (q changes from 0.5 to 4). In my example q=0. For q=0 I got one curve in a plot. How can I get the plot with multiple curves, each corresponding to different q value.
t_in_before=19;
q=0.9;
t_out=-1;
time=0;
while t_in_before>5
t_in_after=t_in_before + (q*t_out)/154 - (q*t_in_before)/154;
time=time+1;
t_in_before=t_in_after;
plot(time,t_in_after,'b.-')
hold on
end
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!