Phase diagram of a second-order differential equation
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Roderick
el 10 de Mzo. de 2020
Comentada: Roderick
el 12 de Mzo. de 2020
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?
6 comentarios
darova
el 11 de Mzo. de 2020
- After that, you define a variable F, which depends on the previous meshgrid, and where you are going to evaluate an expression depending only on Y (maybe Y depends on X somehow)
Variable F in this case is just a derivative
(depends on y only, but should be 2 inputs for ode45)
- After that, you define DY, evaluating F on the X=1 point for all the values created on the meshgrid on Y
The correct form would be as following (i think)
DY = F([],Y); % doesn't matter what X=1 (equation doesn't have X variable)
- and then you define DX somehow (I do not understand that point at all).
I evaluated
, but to plot quiver i need u and v (dx and dy)
So i assign dx=1(always) and dy=4y-16
- Up to which point do you that this approach is compatible with the variables that I have already? Could I use this script directly taking into account that I have already the values of the angular variable and its derivative already calculated?
please show your equation
Respuesta aceptada
darova
el 11 de Mzo. de 2020
Editada: darova
el 11 de Mzo. de 2020
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
9 comentarios
darova
el 12 de Mzo. de 2020
Try this
x = 0:0.1:10;
y = sin(x);
u = diff(x);
v = diff(y);
ii = 1:10:length(u); % how many arrows
plot(x,y)
hold on
quiver(x(ii),y(ii),u(ii),v(ii))
hold off
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

