specific solution in a vector field of a equation system

2 ビュー (過去 30 日間)
Alvaro Mª Zumalacarregui Delgado
Alvaro Mª Zumalacarregui Delgado 2021 年 3 月 3 日
回答済み: Nagasai Bharat 2021 年 3 月 11 日
I create a vector field of a equation system, also I want to represent the spefic solution of the system in that field but I think that I do it wrong.
this is the system:
dx/dt=P-ay
dy/dt=Q-bx
the code:
x1=-1;
x2=5;
y1=-1;
y2=5;
N = 20;
x = linspace(x1,x2,N);
y = linspace(y1,y2,N);
[X,Y]= meshgrid(x,y);
U1 = P - a.*Y;
V1 = Q - b.*X;
quiver (app.Axes2,X,Y,U1,V1);
xlim(app.Axes2,[0 5])
ylim(app.Axes2,[0 5])
hold (app.Axes2,'on')
yh = (P/a)./100;
xh1 = -10;
xh2 = 40;
plot (app.Axes2,[xh1,xh2],[yh,yh]);
hold (app.Axes2,'on')
yv1 = -10;
yv2 = 40;
xv = (Q/b)./100;
plot (app.Axes2,[xv,xv],[yv1,yv2])
hold (app.Axes2, 'on')
s = Q.*x-(b.*x.^2)/2-P.*y+(a.*y.^2)/2;
plot (app.Axes2,x,s,'r')
hold (app.Axes2,'off')
and the axes:
I think that the code is correct but it doesn't have any sense the axes for me, someone could help me?

回答 (1 件)

Nagasai Bharat
Nagasai Bharat 2021 年 3 月 11 日
Hi,
From my understanding you are manually trying to solve the equation. The following documentation should help you solve the system of differential equations in an efficient way.

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by