integralΒΆ

integral computes an approximation of the integral via the trapezoidal method.

rvIntegral = integral(rvY)
rvIntegral = integral(rvY, bOnlyTotalValue)
rvIntegral = integral(rvX, rvY)
rvIntegral = integral(rvX, rvY, bOnlyTotalValue)

Return Value

If bOnlyTotalValue is TRUE (1) the function returns the final integral value (region under the graph). Otherwise rvIntgral is a real vector.

Parameters

rvX

rvX is a vector with x coordinates.

rvY

rvY is a vector with y coordinates. If the function is invoked without rvX the integral is computed with unit spacing.

bOnlyTotalValue

If bOnlyTotalValue is TRUE (1), the function returns a scalar value. Default value is FALSE (0).

Example

* rvX = 0:PI/100:PI
* rvY = sin(X)
* integral(rvX, rvY, 1)
     1.9998

id-675636