integ
Numerical integration over Y with respect to X.
Syntax
Section titled “Syntax”M = integ(X, Y)M = integ(X, Y, flag)Description
Section titled “Description”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).
Examples
Section titled “Examples”x = linspace(0, pi, 100);integ(x, sin(x)) % ≈ 2 (∫sin(x)dx from 0 to π)See also
Section titled “See also”integabs— Numerical integration of|Y|with respect toX.diff— Differences between adjacent elements.
Also categorized under: Range Functions / Math.