function showBisectFx
% showBisectFx  Watch convergence of bisect

  % -- Embedded test function
  function z = fx(x)
    z = 1.4 - 1./(x.^2.71 - 3) - 0.234*x.^1.2;
  end

% -- Plot f(x)
x = linspace(1.5,6);
plot(x,fx(x),'-');
hold('on')
ylim([-5,3])
grid('on')

% -- Bisection iterations
fprintf('\nIterations with bisect and a bracket\n\n')
fprintf('  xleft   xright     r          f(r)       f.count\n')
xb = [1.51 2; 4 5; 2 20];
for i = 1:size(xb,1)
  [r,fcount] = bisectNew(@fx,xb(i,:));
  fr = fx(r);
  plot(r,fr,'o');
  fprintf('%7.2f %7.2f  %8.5f  %12.3e  %6d\n',xb(i,:),r,fr,fcount)
end

end