Skip to content

cumtrapz

general · scripts/general/cumtrapz.m

  z = cumtrapz (y)
  z = cumtrapz (x, y)
  z = cumtrapz (..., dim)
Cumulative trapezoidal numerical integration of y.
Along dimension dim (default: the first non-singleton dimension)
the result starts at zero and each following element adds the area of
the next trapezoid.  Without x the sample spacing is one.
x is either a vector with as many elements as y has along
dim, or an array of the same size as y.
With two arguments, a scalar second argument is taken as dim.
See also: trapz, cumsum.