Skip to content

integ

Numerical integration over Y with respect to X.

M = integ(X, Y)
M = integ(X, Y, flag)

Returns ∫Y dX computed via the trapezoidal rule on the paired samples X and Y. X and Y must be vectors of the same length. The flag controls whether NaN values are skipped (default) or propagated.

MathJet-specific name; analogous to MATLAB’s trapz(X, Y).

x = linspace(0, pi, 100);
integ(x, sin(x)) % ≈ 2 (∫sin(x)dx from 0 to π)
  • integabs — Numerical integration of |Y| with respect to X.
  • diff — Differences between adjacent elements.

Also categorized under: Range Functions / Math.