totally incorrect calculation of matlab

1 view (last 30 days)
I used quiver to plot a vector field. the code was :
[x,y]=meshgrid(0:1:20);
quiver(x,y,x^3-3*x*y,y^3-3*x^2*y)
However the results were completely different from expected, showing downward arrow at x=0, which should have been upward. Other arrows didn't match either.

Accepted Answer

Mischa Kim
Mischa Kim on 10 Dec 2014
Edited: Mischa Kim on 10 Dec 2014
Jaein, use instead
[x,y] = meshgrid(0:1:20);
quiver(x,y,x.^3-3*x.*y,y.^3-3*x.^2.*y) % note the dot-notation

More Answers (1)

Jaein
Jaein on 10 Dec 2014
Thank uuuuuu

Categories

Find more on Vector Fields in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!