# roots

Polynomial Roots

### roots(p)

• It returns the roots of the following polynomial: $$p_nx^n+p_{n-1}x^{n-1}+\cdots+p_1x+p_0.$$
• p is a vector containing the coefficents, where p(1) corresponds to the highest order term.
• p should be non-empty and should not contain inf and nan.
• If p is a logical or character array, it will be converted to a double array before executing poly(a).

Example 1: Roots of a polynomial of order 6. Complex roots are shown in conjugate pairs.

roots([0.5 0.5 1 2 3 7 8])

ans =
1.138 + 1.345i
1.138 - 1.345i
-0.335 + 1.605i
-0.335 - 1.605i
-1.303 + 0.469i
-1.303 - 0.469i


Example 2: Polynomial coefficients can be complex. In this case, the roots are not necessarily conjugate pairs.

roots([0 0 1+i 2 3+0.5i])

ans =
-0.223 + 1.852i
-0.777 - 0.852i