MATLAB: Phase diagram of a second-order differential equation

phase diagram of a second-order differential equation

Hello everyone
I have solved a second-order differential equation, and as a result of it I have obtained the values of an angle, phi, and its first derivative on time, phidot, assuming that a time equal to zero both are zero. Now, I would like to do a phase diagram as the one that I have attached. Which is the most suitable function to plot and what I need?
Any suggestion?

Best Answer

It's your equation
Assume you have a curve
Then to create a quiver or streamline you need ( ϕ, , u, v )
I looked here and see that (ϕ, ) in [ ]
What is the connection between u, v and ?
So substituting (ϕ, ) in we have angle
I assume u=1, then v=a
I used parameters you gave
F = @(phi,dphi) -OmegaR^2/4*sin(4*phi) -2*Omegae*gamma*Hy*cos(phi) -2*Omegae*alpha*dphi;
xx = -pi:0.3:pi;
[p,dp] = meshgrid(xx); % grid for phi and dphi
v = F(p,dp)./dp;
u = v*0 + 1;
quiver(p,dp,u,v,'b')
hold on
streamline(p,dp,u,v,xx,xx,'r')
hold off
i got this
streamline somehow didn't work