Z = cumtrapz(Y)
Z = cumtrapz(X, Y)
Z = cumtrapz(Y, dim)
Z = cumtrapz(X, Y, dim)
| Parameter | Description |
|---|---|
| Y | vector or matrix (real or single) |
| X | point spacing: vector |
| dim | dimension: positive integer scalar |
| Parameter | Description |
|---|---|
| Z | cumulative integral: same size as Y. |
cumtrapz(Y) computes the cumulative integral of Y using the trapezoidal method with unit spacing, along the first non-singleton dimension.
cumtrapz(X, Y) integrates Y with respect to the coordinates given by X.
The result has the same size as Y, and its first value along the working dimension is 0.
x = 0:0.1:pi;
Z = cumtrapz(x, sin(x))
| Version | Description |
|---|---|
| 2.0.0 | initial version |