how can i plot graphs with various colors
Show older comments

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
Answers (1)
Azzi Abdelmalek
on 4 Oct 2013
Edited: Azzi Abdelmalek
on 4 Oct 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 Comment
sruteesh kumar
on 4 Oct 2013
Categories
Find more on Graphics Object Properties in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!