MATLAB Functions | Help Desk |
cumtrapz
Cumulative trapezoidal numerical integration
Z = cumtrapz(Y) Z = cumtrapz(X,Y) Z = cumtrapz(... dim)
Z = cumtrapz(Y)
computes an approximation of the cumulative integral of Y
via the trapezoidal method with unit spacing. (This is similar to cumsum(Y)
, except that trapezoidal approximation is used.) To compute the integral with other than unit spacing, multiply Z
by the spacing increment.
For vectors, cumtrapz(Y)
is the cumulative integral of Y
.
For matrices, cumtrapz(Y)
is a row vector with the cumulative integral over each column.
For multidimensional arrays, cumtrapz(Y)
works across the first nonsingleton dimension.
Z = cumtrapz(X,Y)
computes the cumulative integral of Y
with respect to X
using trapezoidal integration. X
and Y
must be vectors of the same length, or X
must be a column vector and Y
an array.
If X
is a column vector and Y
an array whose first nonsingleton dimension is length(X)
, cumtrapz(X,Y)
operates across this dimension.
Z = cumtrapz(... dim)
integrates across the dimension of Y
specified by scalar dim
. The length of X
must be the same as size(Y,dim)
.
cumsum
Cumulative sum
trapz
Trapezoidal numerical integration