This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

라이선스가 부여된 사용자만 번역 문서를 볼 수 있습니다. 번역 문서를 보려면 로그인하십시오.


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. To compute the integral with other than unit spacing, multiply Z by the spacing increment. Input Y can be complex.

For vectors, cumtrapz(Y) is a vector containing the cumulative integral of Y.

For matrices, cumtrapz(Y) is a matrix the same size as Y 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 whose first nonsingleton dimension is length(X). cumtrapz operates across this dimension. Inputs X and Y can be complex.

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, using any of the input arguments in the previous syntaxes. The length of X must be the same as size(Y,dim).


Example 1

Y = [0 1 2; 3 4 5];

ans =
0         0         0
    1.5000   2.5000    3.5000

ans =
0    0.5000    2.0000
        0    3.5000    8.0000

Example 2

This example uses two complex inputs:

z = exp(1i*pi*(0:100)/100);

ct = cumtrapz(z,1./z);
ans =
   0.0000 + 3.1411i

See Also


Introduced before R2006a

Was this topic helpful?