% [h,area,err] = corr_trap(a,b,n)

function [h,area,err] = corr_trap(a,b,n)

h = (b-a)/(n-1);
for i=1:n
  x(i) = a + (i-1)*h;
end

area = 0;
for i=1:n-1
  area = area + f(x(i))/2 + f(x(i+1))/2; 
end
area = area*h;
area = area - h^2*(fp(b)-fp(a))/12;

err = area - (f_int(b)-f_int(a));
