function T = comptrap(a,b,N)
% Composite Trapezoid Rule for function f(x) 
% on [a,b] using N steps
f = @(x) exp(x);
h = (b-a)/N;
i = 0:N-1;
xi = a+i*h;
xi1 = a+(i+1)*h;
T = (h/2)*sum(f(xi)+f(xi1));
end

