FUNCTION REFERENCE

trapz

Trapezoidal integral.

Trapezoidal integral.

Syntax

trapz(Y)

Syntax

trapz(X, Y)

Syntax

trapz(Y, dim) or trapz(X, Y, dim)

X is a vector of sample points; without X the spacing is 1.

Example

trapz([1 2 3])   % 4

Differences from MATLAB: 2-D data; scalar spacing or a vector X. Complex Y works with a real vector X, where a scalar X is an error as in MATLAB; complex X is not supported.

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