MATLAB: How to multi-color different models in model array responses

colorcontrolControl System Toolboxcontrol-toolboxMATLABplot

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!

Best Answer

  • A way to perform this is using findobj to get the line handles and set their colors.