% centralforceexample -- a code to show a nonconservative central force
% field.

set(0,'DefaultAxesFontSize',18)
[x1,y1]=meshgrid([-9:.5:9],[-9:.5:0]);
[x2,y2]=meshgrid([-9:.5:9],[0:.5:9]);
f=@(x,y) (x.^2+y.^2);
g=@(x,y) 3*(x.^2+y.^2);
z1=f(x1,y1);
z2=g(x2,y2);
[fx1,fy1]=gradient(z1,1);
[fx2,fy2]=gradient(z2,1);
quiver([x1 x2],[y1 y2],[fx1 fx2],[fy1 fy2])
axis square