Create a vector field
Show older comments
I am trying to create a vector field of a equation system, but I think that I have the slope wrong:
this is the system:
dx/dt = P-ay
dy/d t= Q-bx
And this my code:
x1=0;
x2=5;
y1=0;
y2=5;
N = 20;
x = linspace(x1,x2,N);
y = linspace(y1,y2,N);
[X,Y]= meshgrid(x,y);
U = -P+a.*y;
V = -Q+b.*x;
[U,V]=meshgrid(U,V);
quiver (app.Axes2,X,Y,U,V);
This is the field I have get it, which from my point of view it doesn't have too many sense:

Accepted Answer
More Answers (0)
Categories
Find more on Ordinary Differential Equations 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!