How to multi-color different models in model array responses?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Sagie
el 11 de Mzo. de 2014
Respondida: Sagie
el 28 de Jul. de 2014
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 comentarios
Respuesta aceptada
Más respuestas (1)
Craig
el 13 de Mzo. de 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 comentarios
Craig
el 24 de Mzo. de 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.
Ver también
Categorías
Más información sobre Response Computation and Visualization en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!