
for i = 1:6
   err_thint(i) = thint(@circle, 0, 1, 10^(i))*4 - pi;
   err_midpt(i) = midpoint1(@circle, 0, 1, 10^(i))*4 - pi;
end
semilogy(1:6, abs(err_midpt), 'g-+', 1:6, abs(err_thint), 'g-o');
hold on

for i = 1:6
   err_thint(i) = thint(@improper, 0, 1, 10^(i)) - 2;
   err_midpt(i) = midpoint1(@improper, 0, 1, 10^(i)) - 2;
end
semilogy(1:6, abs(err_midpt), 'b-+', 1:6, abs(err_thint), 'b-o');
legend('circle, thint', 'circle, midpoint', ...
   'improper, thint', 'improper, midpoint');
ylabel('log10 absolute error','fontsize',16)
xlabel('log10 number of steps','fontsize',16)
title('Integrating nasty functions','fontsize',20)
hold off
