How to plot phase portrait given a system of equations

조회 수: 11 (최근 30일)
Missael Hernandez
Missael Hernandez 2021년 2월 12일
댓글: prajith samraj 2021년 8월 18일
Suppose I have the system represented as
How would I plot the phase portriats for A=0.5,1, and 3? I know how to do it if I was given the equations, but I am confused how I would do it given matrix notation. Thank you.

채택된 답변

Alan Stevens
Alan Stevens 2021년 2월 12일
Do you mean something like this
A = 0.5;
M = [A 0; 1 A];
dXdt = @(t,X) M*X;
tspan = [0 1];
X0 = [1; 1];
[t, X] = ode45(dXdt, tspan, X0);
x1 = X(:,1); x2 = X(:,2);
V = dXdt(t,X')';
v1 = V(:,1); v2 = V(:,2);
figure
plot(t,x1,t,x2), grid
xlabel('t'),ylabel('x')
legend('x1','x2')
figure
subplot(2,1,1)
plot(x1,v1),grid
xlabel('x1'),ylabel('v1')
subplot(2,1,2)
plot(x2,v2),grid
xlabel('x2'),ylabel('v2')
  댓글 수: 3
prajith samraj
prajith samraj 2021년 8월 18일
can you solve any non linear differential equation?
prajith samraj
prajith samraj 2021년 8월 18일
x'' + a x' +bx+cx^3 +c x5= f coswt
how would you plot phase portrait . i have some parameter from above equations and i have choose the control parameter f. how to write phase portrait code in matlab.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by