![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/528919/image.png)
vector fields in Matlab
1 view (last 30 days)
Show older comments
Alvaro Mª Zumalacarregui Delgado
on 23 Feb 2021
Commented: Alvaro Mª Zumalacarregui Delgado
on 23 Feb 2021
I am trying to create a vector field of a diferential equation system, I know what is the real vector field, but with my code I get another. I paste my code, the system, my vector field, which is wrong, and the good vector field, someone knows what part of my code is wrong?
my code:
x1=0;
x2=2;
y1=0;
y2=2;
N = 20;
x = linspace(x1,x2,N);
y = linspace(y1,y2,N);
[X,Y]= meshgrid(x,y);
m1 = a.*x.*y/b.*x.*y;
S1 = atan (m1);
U = - cos (S1);
V = - sin (S1);
[U,V]=meshgrid(U,V);
quiver (app.Axes2, X,Y,U,V);
the system
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/528649/image.png)
my vector field, that is wrong
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/528654/image.png)
the good one
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/528659/image.png)
0 Comments
Answers (1)
See Also
Categories
Find more on Graphics Objects 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!