[x,y]=meshgrid(0:0.1:pi);z=cos(x.^2+y.^2);surf(x,y,z)
[dx, dy]=gradient(S,0.1,0.1); hold on; quiver(dx, dy);axis('square');grid on 你取的...