Graviton
Graviton

Reputation: 83254

Matlab: Find the Range for Polynomial Equations

I have a polynomial, y(x)=a0+a1*x^1+a2*x^2+a3*x^3+a4*x^4+......+an*x^n. of the degree n, where ai is a real number.

My question is, is there a function in matlab that I can use to find the range of x for all y(x)>0?

Upvotes: 1

Views: 2154

Answers (2)

Jacob
Jacob

Reputation: 34601

I can't think of a function but I would do the following:

  1. Find the roots of your polynomial with roots.
  2. Find the gradient of y(x) at the smallest root.
  3. If it is increasing, then it will decrease at the next root and vice versa.
  4. Now you can create intervals where y(x) is positive.

Additionally, if you want visualize your answers, you can plot your polynomial with ezplot. E.g. ezplot('5*x^3 + 4*x^2 + 3*x + 2');

Upvotes: 2

user85109
user85109

Reputation:

No there is no explicit function that does this. However, as long as you desire a numerical solution, it is possible.

You can solve for the roots of y(x). (hint: roots)

What happens between any pair of roots? What happens above and below the largest and smallest real roots? What can you do with any roots that are complex?

Upvotes: 2

Related Questions