O = '---- Range of step sizes using midpoint2 ---- = O'
Nfor = 300;
pow = [1,2,3,4,5,6,7];
Nsteps = (10.^pow).*Nfor
Ntrials = numel(pow)
for i = 1:Ntrials
   t0 = cputime;
   errors(i) = midpoint2(@circle, 0, 1, Nfor, 10^pow(i))*4 - pi;
   error = errors(i)
   execution_time = cputime - t0
end
plot(log10(Nsteps), log10(abs(errors)), 'o-r');
xlabel('log10 number of steps', 'fontsize', 16);
ylabel('log10 absolute error', 'fontsize', 16);
title('midpoint rule integration of the unit circle', 'fontsize', 18);
