How to plot phase plane in MATLAB?

조회 수: 29 (최근 30일)
Alex
Alex 2014년 2월 19일
답변: Elistin 2022년 10월 24일
Hi I have two equations here, and I wonder that how do you plot them as a phase plane.
du/dt = wu^2 - Bu dw/dt = A - w - wu^2
and A,B both are constants

채택된 답변

Mischa Kim
Mischa Kim 2014년 2월 23일
Alex, assuming that you are talking about a u-w (position-velocity, sort of) phase plot, here you go. Essentially, you only need to solve the differential equations and then plot the result.
function my_phase()
[~,X] = ode45(@EOM,[0 50],[1 1]);
u = X(:,1);
w = X(:,2);
plot(u,w)
xlabel('u')
ylabel('w')
grid
end
function dX = EOM(t, y)
dX = zeros(2,1);
u = y(1);
w = y(2);
A = 1;
B = 1;
dX = [w*u^2 - B*u;...
A - w - w*u^2];
end
  댓글 수: 2
Alex
Alex 2014년 2월 23일
I wonder that why did you set A and B both are equal to 1?
Mischa Kim
Mischa Kim 2014년 2월 23일
Had to pick some values to do the simulation.

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

추가 답변 (1개)

Elistin
Elistin 2022년 10월 24일
fonction ma_phase()
[~,X] = ode45(@EOM,[0 50],[1 1]);
u = X(:,1);
w = X(:,2);
parcelle(u,w)
xlabel( 'u' )
ylabel( 'w' )
la grille
fin
fonction dX = EOM(t, y)
dX = zéros(2,1);
u = y(1);
w = y(2);
A = 1 ;
B = 1 ;
dX = [w*u^2 - B*u ; ...
A - w - w*u^2] ;
fin

카테고리

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