How to multi-color different models in model array responses?
1 回表示 (過去 30 日間)
古いコメントを表示
I would like to visualize different responses of different systems in a single plot, using Matlab's control toolbox, and to colorize the various curves so it is easy to differentiate between the different systems.
The response plots are easily created using the control toolbox, e.g. step response (using step), response to an arbitrary input (using lsim), etc.
When using separate model objects for the different systems, It's easy to create multi-color plots, e.g., for a step response:
step(Sys1, 'b', Sys2, 'r')
The command above would give one blue curve and one red cure, if Sys1 and Sys2 are each a single system model.
However, if plotting a model array, there's no way to differentiate between the various curves that belong to the same array. E.g.: step(SysArray, 'b') would make all curves blue. step(Sys,'b','r') is invalid - so no easy way to specify various colors. Also, using the "Edit Plot" tool, selecting one curve effectively selects all curves, and any changes to the properties (e.g. line color) would affect all curves.
Is there any way to control the properties of each curve separately?
Thanks in advance!
0 件のコメント
採用された回答
その他の回答 (1 件)
Craig
2014 年 3 月 13 日
One option is to plot them using a loop such as:
figure
hold on
Color = {'b','r','g','k'};
sys = rss(2,1,1,4);
for ct = 1:4
stepplot(sys(:,:,ct),Color{ct});
end
2 件のコメント
Craig
2014 年 3 月 24 日
There is not a way to treat each line in the system array seperately.
However if you want to toggle the visibility of elements in the array you can achieve that by right clicking the axes and selecting the "Array Selector..." menu item. Also, if you click on a line it will show you in the data tip which element it is.
参考
カテゴリ
Help Center および File Exchange で Response Computation and Visualization についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!