gradient
Numerical gradient of a scalar field.
Syntax
Section titled “Syntax”[Fx, Fy] = gradient(F)[Fx, Fy, Fz] = gradient(F)[Fx, Fy] = gradient(F, hx, hy)Description
Section titled “Description”Returns the numerical gradient of F along each dimension. hx/hy (default 1) are the grid spacings; for non-uniform grids, pass coordinate vectors.
Examples
Section titled “Examples”[gx, gy] = gradient(peaks(50));quiver(gx, gy)See also
Section titled “See also”divergence— Divergence of a vector field.curl— Curl of a vector field.diff— Differences between adjacent elements.