Effacer les filtres
Effacer les filtres

How to define different color for all three plots?

2 vues (au cours des 30 derniers jours)
Shauvik Das
Shauvik Das le 10 Nov 2019
Commenté : Shauvik Das le 10 Nov 2019
omega = 1; alpha = 1;beta=1;
f=@(ts,theta)[omega + alpha*(sin((theta(2)-theta(1))));
omega + alpha*(sin(theta(1)-theta(2)))+beta*(sin(theta(3)-theta(2)));
omega + beta*(sin((theta(2)-theta(3))))];
range = [0,1];
thetainit = [0.1,0.3,0.2];
[range,theta] = ode45(f,range,thetainit);
plot(range,theta,'Linewidth', 2)
xlabel('Range');
ylabel('Theta');
legend('Theta1','Theta2','Theta3');

Réponse acceptée

JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH le 10 Nov 2019
solution:
omega = 1; alpha = 1;beta=1;
f=@(ts,theta)[omega + alpha*(sin((theta(2)-theta(1))));
omega + alpha*(sin(theta(1)-theta(2)))+beta*(sin(theta(3)-theta(2)));
omega + beta*(sin((theta(2)-theta(3))))];
range = [0,1];
thetainit = [0.1,0.3,0.2];
[range,theta] = ode45(f,range,thetainit);
h=plot(range,theta,'Linewidth', 2);
set(h,{'Color'},{'r'; 'g'; 'b'})
xlabel('Range');
ylabel('Theta');
legend('Theta1','Theta2','Theta3');

Plus de réponses (0)

Catégories

En savoir plus sur GPU Computing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by