Clear Filters
Clear Filters

How to plot phase plane in MATLAB?

19 views (last 30 days)
Alex
Alex on 19 Feb 2014
Answered: Elistin on 24 Oct 2022
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

Accepted Answer

Mischa Kim
Mischa Kim on 23 Feb 2014
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 Comments
Alex
Alex on 23 Feb 2014
I wonder that why did you set A and B both are equal to 1?
Mischa Kim
Mischa Kim on 23 Feb 2014
Had to pick some values to do the simulation.

Sign in to comment.

More Answers (1)

Elistin
Elistin on 24 Oct 2022
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

Community Treasure Hunt

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

Start Hunting!