Automaticly generate plots and different legend
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,
let k is variable. For example, if k=3, then I will have speed1 speed2 speed3.
How can I automaticly generate one plot with all speeds and also different legend for each one?
Thanks
ps:t=0:0.01:100
0 Kommentare
Akzeptierte Antwort
Azzi Abdelmalek
am 21 Mär. 2013
Bearbeitet: Azzi Abdelmalek
am 21 Mär. 2013
t=0:0.01:100
speed1=cos(0.01*t);
speed2=sin(0.05*t);
speed3=cos(0.1*t);
y=[speed1;speed2;speed3];
plot(t',y');
for k=1:size(y,1)
leg{k}=sprintf('speed%d',k);
end
legend(leg);
6 Kommentare
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!