function r = bisect(f, a, b, tol) x = a:tol:b; plot(x, f(x), x, 0) hold on r = bisection(f, a, b, tol);