Find the roots of a polynomial in Matlab

154 Views Asked by At

I have a polynomial $f$ of order 15 and I want to find its roots.

For solve(f==0), the answer is Warning: Explicit solution could not be found.

What can I do to compute the roots?

1

There are 1 best solutions below

1
On BEST ANSWER

If you want to solve $f(x)=0$ where $f$ is a polynomial, you can use the roots() function in Matlab.

Example Let $f(x)= x^{15}-2x^{14}+3x^{13}-4x^{12}+...+15x^1-16$, then define a vector $v$ as the vector of all the coefficients in decreasing order, i.e.

v = [1 -2 3 -4 5 -6 7 -8 9 -10 11 -12 13 -14 15 -16]

then roots(v) returns all roots of $f$

roots(v)
ans =

   1.2367 + 0.0000i
   1.1461 + 0.4609i
   1.1461 - 0.4609i
   0.8883 + 0.8525i
   0.8883 - 0.8525i
   0.5027 + 1.1159i
   0.5027 - 1.1159i
   0.0489 + 1.2119i
   0.0489 - 1.2119i
  -0.4030 + 1.1270i
  -0.4030 - 1.1270i
  -0.7812 + 0.8754i
  -0.7812 - 0.8754i
  -1.0202 + 0.4962i
  -1.0202 - 0.4962i

which are complex in this case.