Gradient of a function defined at discrete points on a rectangular grid.
f Any numeric array.
y An array of the same size as x , which is a numerical approximation to the gradient of the function whose values at the points on a rectangular grid are the elements of f .

The x- axis is assumed to be along the rows of the matrix, and the y- axis along the columns. The gradient is computed by using backward differences, i.e., fx[i,j]=(f[i,j]-f[i,j-1])/hx, j>1 , with fx[i,1]=fx[i,2] , and likewise for the second component of the gradient. If hx or hy is not specified, it is assumed to be 1 .