specific solution in a vector field of a equation system

4 views (last 30 days)
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?

Answers (1)

Nagasai Bharat
Nagasai Bharat on 11 Mar 2021
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.

Categories

Find more on Vector Fields in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!