SUNY Geneseo Department of Mathematics
Friday, April 1
Math 230 02
Spring 2016
Prof. Doug Baldwin
trapezoid( f, a, b, n )
x = linspace( a, b, n+1 )
deltaX = (b-a)/n
for i = 1:n % i is number of current trapezoid
A(i) = ( f(x(i)) + f(x(i+1)) ) / 2 * deltaX
return sum(A)