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
回答(1 个)
Azzi Abdelmalek
2013-10-4
编辑:Azzi Abdelmalek
2013-10-4
[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)')
类别
在 帮助中心 和 File Exchange 中查找有关 Graphics Object Properties 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!