Qu

trapz

Builtin index · Signal processing

trapz(y), trapz(x, y)

Input: y · Output: no output

What it is

Trapezoid-rule integral of the samples y against x (unit spacing when x is omitted), summed with compensated (Neumaier) summation. x may be unevenly spaced but must have the length of y. Like MATLAB, a matrix y is integrated along dimension 1: each column is a signal and the result is a Vec with one integral per column; a vector (or a one-row matrix) gives a number. Fewer than two samples integrate to 0. Error order O(h^2).

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
trapz(y), trapz(x, y)
y matrix, Vec, vector, or numbernot documented yet
not documented yetFewer than two samples integrate to 0. Error order O(h^2).

Examples

No documentation example calls this form yet. The Signal processing chapter is where one belongs.

How it works

and general minimization. Only a user-defined function (by name, the same convention pmap/spawn use) can be the target of any of these — not a builtin. fzero(f, a, b, [tol=1e-10], [max_iter=100]) — Brent's method: robust root finding (guaranteed convergence given a bracket [a,b] where f changes sign), no derivative needed. The "something better than plain bisection" choice.

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.