Coloring Different Models in Model Array Plots (Matlab) -


i visualize different responses of different systems in single plot matlab's control toolbox, , colorize various curves easy differentiate between different systems.

the response plots created using control toolbox - e.g. step response (using step), response arbitrary input (using lsim), etc.

when using separate model objects different systems, it's easy create multi-color plots, e.g., step response: step(sys1, 'b', sys2, 'r') give 1 blue curve , 1 red cure, if sys1 , sys2 both single system model.

however, if plotting model array, there's no way differentiate between various curves belong same array. e.g.: step(sysarray, 'b') make curves blue. step(sys,'b','r') invalid - no easy way specify various colors. also, using "edit plot" tool, selecting 1 curve selects curves, , changes properties (e.g. line color) affect curves.

is there way control properties of each curve separately?

there's no built-in function this, have roll own functionality

% create n-by-3 array of colours use coloursarray = rand(numel(stackedsystems),3); % example put in random colours % plot step(stackedsystems); title('my custom title'); grid on % change colours ha = findobj(gcf,'type','axes','visible','on'); % handles of axes (for mimo responses) jdx = 1:numel(ha)    hl = findobj(ha(jdx),'type','line','visible','on'); % handles lines    idx = 1:numel(hl)        set(hl(idx),'color',coloursarray(idx,:));  %  change colour    end end 

Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -