FUNCTION REFERENCE

gradient

Numerical gradient.

Numerical gradient.

Syntax

FX = gradient(F)

Syntax

FX = gradient(F, h)

Syntax

[FX, FY] = gradient(F, hx, hy)

Central differences inside, one-sided differences at the edges. For a vector

F the derivative is along its length; for a matrix FX is along the rows

(across columns) and FY along the columns.

Example

gradient([1 4 9 16])   % [3 4 6 7]

Differences from MATLAB: scalar spacings only (no coordinate vectors); two

outputs at most.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.