FUNCTION REFERENCE
diff
Differences between neighboring elements.
Differences between neighboring elements.
Syntax
diff(A)Syntax
diff(A, n)Syntax
diff(A, n, dim)n is the order (default 1; [] means 1). The default dimension follows MATLAB R2025a and later.
Example
diff([1 4 9]) % [3 5]Differences from MATLAB: Real and complex 2-D arrays; dim must be 1 or 2. A complex difference with zero imaginary parts is real.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.