How to multi-color different models in model array responses?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Plus de réponses (1)
Craig
le 13 Mar 2014
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 commentaires
Craig
le 24 Mar 2014
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.
Voir également
Catégories
En savoir plus sur Response Computation and Visualization dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!