GRADIENT Approximate gradient.
[FX,FY] = GRADIENT(F) returns the numerical gradient of the
matrix F. FX corresponds to dF/dx, the differences in the
x (column) direction. FY corresponds to dF/dy, the differences
in the y (row) direction. The spacing between points in each
direction is assumed to be one. When F is a vector, DF = GRADIENT(F)
is the 1-D gradient.
[FX,FY] = GRADIENT(F,H), where H is a scalar, uses H as the
spacing between points in each direction.