# Finding Roots Of Polynomials In Matlab®(Illustrated Expression)

Polynomial calculations are very easy in Matlab®. Also, the calculation of roots of a polynomial can be very tough in calculus. Sometimes you can have a very long and complex polynomial to calculate its roots by hand. You can do this kind of stuff in Matlab® with the ‘roots()’ command very easily. Here, we explained the use of the ‘roots()’ command in Matlab® to find out the roots of polynomials, with a very basic example.

On this post

## How To Use ‘roots()’ Command In Matlab®?

``````>> a = [5 6 8 4 3];
roots(a)

ans =

-0.5866 + 0.7505i
-0.5866 - 0.7505i
-0.0134 + 0.8130i
-0.0134 - 0.8130i

>> ``````

First of all, you need to know how to define polynomials in Matlab®. To define a polynomial, you need to create a vector that represents this polynomial in Matlab®. For example, we created a vector called ‘a’ as shown above, that represents the polynomial of 5x^4+6x^3+8x^2+4x+3. As you understand that each of the coefficients is represented by an element in’ vector, from right to left. So, the logic behind the definition of polynomials in Matlab is this.

YOU CAN LEARN MatLab® IN MECHANICAL BASE; Click And Start To Learn MatLab®!

Calculation of roots of a polynomial in Matlab® is very easy actually. To calculate the roots of polynomials in Matlab®, you need to use theroots()’ command. As you see above example, we calculated the roots of polynomial ‘a’. What we did is just typing the ‘a’ inside the parenthesis of the ‘roots()’ command as shown above. As you see that the result has four roots. All the roots of this polynomial are complex numbers.

Finding or calculating roots of a polynomial with the ‘roots()’ command in Matlab® is very easy like above.

## Conclusion

Do not forget to leave your comments and questions about the ‘roots()’ command in Matlab® below. Your feedback is very important for us.

Your precious feedbacks are very important to us.

Posted

in

by