%%BISECTION.M  Bisection algorithm for nonlinear root-finding. 
% JACW 2014.

fa = f(a); fb = f(b);          % Function values
while ( (b-a)/2 > tol )        % Start iteration
    c = (a+b)/2; fc = f(c);    % Bisect
    disp([c fc])               % Display values
    if ( fa*fc < 0 )          
        b = c; fb = fc; 
    else
        a = c; fa = fc; 
    end
end
