Skip to content

trapz

general · scripts/general/trapz.m

  q = trapz (y)
  q = trapz (x, y)
  q = trapz (..., dim)
Integrate y with the trapezoidal rule along dimension dim
(default: the first non-singleton dimension).
Without x the sample spacing is 1.  x is either a vector
whose length equals size (y, dim) or an array of the same size as
y.  With exactly two arguments a scalar second argument is taken
to be dim.
See also: cumtrapz, sum.