function [x,ierr] = bisection(f, a, b, tol, tolf) % % use bisection to calculate a root of f. % % calling sequence: [x,ierr] = bisection(@f, a, b, tol) % % f = name of the matlab function to evaluate function f % a,b = initial endpoints of the interval. Must have a