Opening the book…
A root of a function is an x-value where the function equals zero. Roots are also called zeros or x-intercepts. Root-finding is common in engineering because many problems can be written as equations of the form f(x) = 0.
Roots of Polynomials with roots
If the function is a polynomial represented by a coefficient vector, MATLAB can find its roots using the roots function. The basic format is:
r = roots(polynomialCoefficients);
finding the roots of \(f(x) = 4*x^3 - 2*x^2 - 8*x + 3\).
Solution
r =
-1.3660
1.5000
0.3660
Roots of Nonlinear Functions with fzero
Not every function is a polynomial. For nonlinear functions such as sine, cosine, exponential, or Bessel functions, MATLAB provides fzero.
The basic format is:
xRoot = fzero(functionHandle, startingGuess);
The second input can be a single starting guess or a two-value interval. If it is an interval, the function should change sign over that interval.
Finding the root of cos(2x) near x = 0.1.
Solution
xRoot = 0.7854
Finding the root of the Bessel function of the first kind between the [2 3] interval.
Solution
xRoot = 2.4048
Common Mistake
fzero finds one root near the starting guess or inside the interval. If a function has multiple roots, you may need to try different starting guesses or intervals.
This page titled 12.9: Finding Roots was last modified on Tue, 30 Jun 2026 02:11:52 GMT and is shared under a CC BY-NC-SA license and was authored, remixed, and/or curated by Zara Noroozi.
The book could not be loaded just now.