フィルターのクリア

Adding legends to plots in a for loop

5 ビュー (過去 30 日間)
Andreas Volden
Andreas Volden 2014 年 9 月 4 日
回答済み: Kelly Kearney 2014 年 9 月 4 日
Hi!
I have a rookie problem(see code below). I want to assign legends to every plot, three in total, within the same figure.
I manage to get the plots in said configuration, but my legends don't follow, only the last assigned legend is visible. I've tried several ways without success, and this code is the closest I've gotten. Need some inputs from you guys!
for i=1:3;
a(i) = feedback(sys(i),1);
step(a(i),20);
hold on
if i==1;
legend('Controller ZOH', 'Location', 'NorthWest');
end
if i==2;
legend('Controller Tustin', 'Location', 'NorthEast');
end
if i==3;
legend('Controller Euler', 'Location', 'SouthEast');
end
end
hold off

採用された回答

Kelly Kearney
Kelly Kearney 2014 年 9 月 4 日
Matlab won't allow more than one legend per axis. Perhaps try legendflex if you require it.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLegend についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by