How to draw phase portrait
Afficher commentaires plus anciens
i have a set of eight equations given by the function,
function dx=agestructure(t,x)
dx=zeros(8,1);
dx(1)=912-0.0000905*x(1)*x(8)-0.00004*x(1)-0.00000986*x(1)+0.0027*x(3);
dx(2) = 608+0.00000905*x(1)*x(8)-0.00004*x(2)-0.0014*x(2);
dx(3)= 0.0014*x(2)-0.00004*x(3)-0.00000986*x(3)-0.0027*x(3);
dx(4)= 505.49+0.00000986*x(1)-0.00000905*x(4)*x(8)-0.00004*x(4)+0.0027*x(6);
dx(5)= .506+0.00000905*x(4)*x(8)-0.00004*x(5)-0.0035*x(5);
dx(6) = 0.0035*x(5)-0.00004*x(6)+0.00000986*x(3)-0.0027*x(6);
dx(7)= 500-0.000041665*x(7)*(x(2)+x(5))-0.05*x(7);
dx(8)=0.000041665*x(7)*(x(2)+x(5))-0.05*x(8);
end
I am able to draw the phase portrait using the following commands:
options=odeset('OutputFcn',@odephas2);
[t,xa]=ode45(@(t,x)g(t,x),[0 300],[3500,0,0,6500,0,0,1000,550],options);
Is it possible for me to show the vector field and path of the trjectory using 'quiver'?
1 commentaire
Avinash
le 16 Août 2022
can u please send a working code like what values you have defined to x(1) and others
Réponses (1)
plot(t,xa(:,1))
In the baove use your required index for the column and plot. You can use quiver, if you have vectors. Assuming your fixt column is displacement, you can plot phase potrait using:
s = xa(:,1) ;
plot(s,gradient(s))
Catégories
En savoir plus sur Programming dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!