Works brilliantly in my case. Replaces a loop with ~1 million iterations, brings down execution time by several orders of magnitude.
Plus it is well-written and well-documented and a numerically robust method.
I am so glad I found this submission and I'm very grateful to the author for providing an excellent, well-documented code. I had my custom Newton-Raphson algorithm (with provided analytical gradient) invoked thousands of times inside a for loop. I substituted the loop with a single invocation to bisection.m and achieved a 15x acceleration! Awesome.
I just uploaded an entirely new function with almost all new code and documentation and a lot of added features. With so much new code, please let me know if you find a bug.
This is about as far as I'll take this function. I would love to see MathWorks or someone in the community develop a vectorized implementation of Brent's method, i.e. make FZERO vectorized to be able handle array problems. A vectorized FZERO (with a TolFun feature) would be superior to this in every way.