Reputation: 63
I'm trying to plot a simple vector field but I'm unsure of the syntax for quiver because it doesn't seem to be working. It's just displaying an empty plot. I think it has something to do with the ./ but it won't even run when I remove the period. Thanks
v = -5:0.1:5;
[x,y] = meshgrid(v);
u1=(2./x);
u2=(2.*y./(x.^2));
quiver(x,y,u1,u2);
Upvotes: 1
Views: 359
Reputation: 35175
The problem is that your vector field is infinitely large at x=0
, which messes with the auto-scaling of arrows. Try avoiding the coordinate axes, for instance by using v=linspace(-5,5,10);
. By using an ever number of points on a symmetric domain, you ensure that x=0
and y=0
are never used.
Result using this v
:
Upvotes: 2