<< expm | Linear algebra | inv >> |
FX = gradient(F) |
[FX, FY] = gradient(F) |
[FX, FY, FZ, ..., FN] = gradient(F) |
[...] = gradient(F, h) |
[...] = gradient(F, hx, hy, ... , hN) |
Input array: vector, matrix or multidimensional array.
Uniform spacing between points: scalar or 1 (default).
Spacing between points: vector, scalar or 1 (default).
Numerical gradients: array.
gradient(F) calculates the one-dimensional numerical gradient of the vector or matrix F.
The output FX represents the differences in the x (horizontal) direction, corresponding to ∂F/∂x.
It assumes that the spacing between points is 1.
gradient(F, h) allows for specifying a uniform spacing h between points in each direction.
This uniform spacing can also be individually specified for each dimension of F using gradient(F, hx, hy, ..., hN).
[X, Y] = meshgrid(-2:0.2:2);
Z = X .* exp(-X.^2 - Y.^2);
[U, V] = gradient(Z, 0.2, 0.2);
diff.
Version | Description |
---|---|
1.3.0 | initial version |
Allan CORNET