How to draw phase portrait
이전 댓글 표시
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
Avinash
2022년 8월 16일
can u please send a working code like what values you have defined to x(1) and others
답변 (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))
카테고리
도움말 센터 및 File Exchange에서 Vector Fields에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!