.. highlightlang:: us .. index:: integral .. index:: Trapezoidal rule .. _integral: integral ======== .. us.tag integral NOTREADYENGLISH math-lin-alg :ref:`integral` computes an approximation of the integral via the trapezoidal method. .. function:: rvIntegral = integral(rvY) rvIntegral = integral(rvY, bOnlyTotalValue) rvIntegral = integral(rvX, rvY) rvIntegral = integral(rvX, rvY, bOnlyTotalValue) .. us.return **Return Value** If *bOnlyTotalValue* is TRUE (1) the function returns the final integral value (region under the graph). Otherwise *rvIntgral* is a real vector. .. us.params **Parameters** .. uparam:: rvX *rvX* is a vector with x coordinates. .. uparam:: rvY *rvY* is a vector with y coordinates. If the function is invoked without *rvX* the integral is computed with unit spacing. .. uparam:: bOnlyTotalValue If *bOnlyTotalValue* is TRUE (1), the function returns a scalar value. Default value is FALSE (0). .. us.example **Example** :: * rvX = 0:PI/100:PI * rvY = sin(X) * integral(rvX, rvY, 1) 1.9998 .. seealso:: :ref:`overview-mathematic` :sub:`id-675636`