# How to draw phase portrait

30 views (last 30 days)
nisha budhwar on 29 May 2019
Edited: KSSV on 16 Aug 2022
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'?
Avinash on 16 Aug 2022
can u please send a working code like what values you have defined to x(1) and others

KSSV on 16 Aug 2022
Edited: KSSV on 16 Aug 2022
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) ;