フィルターのクリア

polynomial in matlab roots

5 ビュー (過去 30 日間)
mar vouz
mar vouz 2016 年 1 月 6 日
コメント済み: mar vouz 2016 年 1 月 7 日
Hey ,I have a matrix
X= 0 0,142857142857143 0,285714285714286 0,428571428571429 0,571428571428571 0,714285714285714 0,857142857142857 1
and a matrix
Y=185654
189978
189202
192877
196255
200642
201231
206046
so I created the polynomial by p=polyfit(X,Y,7) and I was asked to find the real solutions of this so I used r=roots(p) and all i get are imaginary numbers. Why?
  1 件のコメント
Roger Stafford
Roger Stafford 2016 年 1 月 6 日
It is not clear what "real solutions" you are trying to find. Solutions to what? The expression "roots(p)" would give you the points where p has a zero value and presumably there are none that are real-valued.
Since you have used degree 7 with 8 points, your polynomial p should match the values of Y at the points X precisely except for tiny round-off errors. Is that the "solution" you are seeking? In that case you already have it.

サインインしてコメントする。

回答 (2 件)

Walter Roberson
Walter Roberson 2016 年 1 月 6 日
Polynomials with an odd number of roots always enter through one side of the Y axis and exit through the other side of the Y axis (because -infinity to an odd power is still negative infinity, opposite sign of +infinity to an odd power, whereas for even number of roots, -infinity to an even power is positive infinity same as +infinity to an even power so with an even number of roots the graph will start and end on the same side.)
The graph plot(X,Y) enters from the lower left so it has to exit through the upper right. It does not cross 0 anywhere in the range of values so there are no internal real roots. The first value is positive. Therefore there must be a single real root that is to the lower left of the graph at an X smaller than any given value.
There would have to be some visible zero crossings within the defined range for there to be multiple real roots.

John D'Errico
John D'Errico 2016 年 1 月 6 日
編集済み: John D'Errico 2016 年 1 月 6 日
A 7th degree polynomial (with real coefficients) has at least ONE real root.
p = polyfit(X,Y',7);
roots(p)
ans =
1.0951 + 0.20415i
1.0951 - 0.20415i
0.63639 + 0.47627i
0.63639 - 0.47627i
0.10224 + 0.36777i
0.10224 - 0.36777i
-0.15631 + 0i
Note that the last root is NOT complex. It has a zero imaginary part. It is the only real root, at x=-0.15631...
  6 件のコメント
Torsten
Torsten 2016 年 1 月 7 日
Since we don't know the background of your question, we can not answer it.
Best wishes
Torsten.
mar vouz
mar vouz 2016 年 1 月 7 日
thank you very much everyone!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangePolynomials についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by