how can i plot graphs with various colors

for jj = 1:12
col=hsv(12);
[T,Y]=ode45(@solve_for_state_error_nonlinear,[0,sim_time],init_cond,options1);
figure
plot(time,Angle_mag(:,1),'color',col(jj,:));
title('Angle with the magnetic field (deg)');
xlabel('time(s)')
end
This is the code i am using and i am getting the plots as shown in the figure.I need a graph with different colors in the same graph but i am getting different graphs with different colors.
Thanks in advance

Respuestas (1)

Azzi Abdelmalek
Azzi Abdelmalek el 4 de Oct. de 2013
Editada: Azzi Abdelmalek el 4 de Oct. de 2013
[T,Y]=ode45(@solve_for_state_error_nonlinear,[0,sim_time],init_cond,options1
col=hsv(numel(T));
for jj = 1:numel(T)
plot(T,Y(jj,1),'.','color',col(jj,:));
hold on
end
title('Angle with the magnetic field (deg)');
xlabel('time(s)')

1 comentario

sruteesh kumar
sruteesh kumar el 4 de Oct. de 2013
Thx @ Azzi Abdelmalek but what actually happens while calculating [T,Y] is there is a term with (jj) hence i get a different [T,Y] for every value of jj and hence i need to plot angle_mag which is calculated from Y for every jj

Iniciar sesión para comentar.

Categorías

Más información sobre Graphics Object Properties en Centro de ayuda y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Preguntada:

el 4 de Oct. de 2013

Comentada:

el 4 de Oct. de 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by