Z = trapz(Y)
Z = trapz(X, Y)
Z = trapz(Y, dim)
Z = trapz(X, Y, dim)
| Parameter | Description |
|---|---|
| Y | vector or matrix (real or single) |
| X | point spacing: vector |
| dim | dimension: positive integer scalar |
| Parameter | Description |
|---|---|
| Z | integral: scalar, vector or matrix. |
trapz(Y) computes the approximate integral of Y using the trapezoidal method with unit spacing, along the first non-singleton dimension.
trapz(X, Y) integrates Y with respect to the coordinates given by X.
Use dim to integrate along a specific dimension.
x = 0:0.1:pi;
Z = trapz(x, sin(x))
| Version | Description |
|---|---|
| 2.0.0 | initial version |