Roots of Polynomials

The roots function calculates the roots of a polynomial:

r = roots(p)

r =
     -1.0473 +      1.1359i
     -1.0473 -      1.1359i

By convention, the MATLAB® software stores roots in column vectors. The function poly returns to the polynomial coefficients:

p2 = poly(r)

p2 =
     1   8.8818e-16   -2   -5

poly and roots are inverse functions, up to ordering, scaling, and roundoff error.

Was this topic helpful?