Phase diagram of a second-order differential equation
5 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
darova
2020 年 3 月 11 日
- 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
採用された回答
darova
2020 年 3 月 11 日
編集済み: darova
2020 年 3 月 11 日
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 件のコメント
darova
2020 年 3 月 12 日
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
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Vector Fields についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!