MATLAB: No arrows appear when plotting direction field with quiver()

direction fieldquiver

I have an equation y' = x – (1/y) and I need to make a direction field for it. Here is the code I have tried:
if true
[x,y] = meshgrid(-10:1:10 -10:1:10);
dy = x - (1./y);
dx = ones(size(y));
quiver(x,y,dx,dy)
end
When I input this I only end up with a grid of points, no vectors. Although when I place a Datatip in the figure window it does display the componets of the vectors that are supposed to be there and correctly. Still i see no reason for the arrows not to appear.
What might I be doing wrong?

Best Answer

The infs are messing with you.
[x,y] = meshgrid(-10:1:10,-10:1:10);
F = x - (1./y);
[dx,dy] = gradient(F,1,1);
dy(isinf(dy)) = nan;
quiver(x,y,dx,dy);