trapz
Numerical integration of discrete data using the trapezoid rule.
Syntax
area=trapz(y)
area=trapz(x,y)
Inputs
- x
- Values of the domain variable.
- y
- Values of the range variable.
Outputs
- area
- The estimated area.
Example
x = [0:0.05:1]*pi; area = trapz(x,sin(x))
area = 1.99588597
Comments
trapz is appropriate for use with sampled data when the function is not available.