vector fields in Matlab

3 views (last 30 days)
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
my vector field, that is wrong
the good one

Answers (1)

darova
darova on 23 Feb 2021
Here is the mistake
  1 Comment
Alvaro Mª Zumalacarregui Delgado
thanks because after correct that the field looks better, but if you look at the bottom of 'the good one' vectors are point and I have vectors like the top of 'the good one', so maybe the value of m1 is wrong, you know how to correct it?

Sign in to comment.

Categories

Find more on Simulink 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!