function M = compmidpt(a,b,N)
% Composite Midpoint Rule for function f(x) 
% on [a,b] using N steps
f = @(x) exp(x);
h = (b-a)/N;
i = 1:N;
ci = a+0.5*(2*i-1)*h;
M = h*sum(f(ci));
end

