Real roots on interval
Updated 29 May 2007
This routine uses an analytical method to find all the real roots of an arbitrary function over an arbitrary interval. The approach used is to approximate the function by a series of Chebyshev polynomials, and then to find the roots of the approximation using a very efficient analytical method due to J.P. Boyd [see Appl. Num. Math. 56 pp.1077-1091 (2006)].
In the form given here, the function for which roots must be found is supplied as a MATLAB anonymous function. For example:
...will find all the real roots of the function besselj(1,x) over the interval [a,b] based on an n-element Chebyshev expansion. At the end of the routine, as well as the calculated roots, the routine gives the time taken plus a plot of the original function and its approximation over the required interval: if the two do not coincide then the user should try again with a larger value of 'n'.
Stephen Morris (2023). Real roots on interval (https://www.mathworks.com/matlabcentral/fileexchange/15122-real-roots-on-interval), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
- MATLAB > Mathematics > Elementary Math > Polynomials >
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.