1. how can I optimize a polynomial with unknown coefficients and unknown order whose x and y values are known?
2 ビュー (過去 30 日間)
古いコメントを表示
if the polynomial is y=c0+c1x+c2x^2+c3x^3+................. values of x & y are known and how i can get what is the order and unknown coefficients to fit the given grapgh
1 件のコメント
Walter Roberson
2014 年 4 月 13 日
If the x and y values are known, is there any possibility of "noise" when y was found? Or only of numeric round-off ? Is y found by a physical measurement?
回答 (2 件)
Star Strider
2014 年 4 月 13 日
2 件のコメント
Star Strider
2014 年 4 月 13 日
編集済み: Star Strider
2014 年 4 月 13 日
Upload your (x,y) data as an attachment to your original question.
What process generated your data?
What else have you tried?
Image Analyst
2014 年 4 月 13 日
編集済み: Image Analyst
2014 年 4 月 13 日
Like Star Strider said, polyfit() will do it. The order you pick is the number of data points minus 1 (e.g. 2 points use 1 to get a line, 3 points use 2 to get a quadratic, etc.). This will ensure that you have the best possible "fit" because the "fitted" curve will go exactly through each and every data point. Of course in between data points and to the left of the left one and to the right of the rightmost one, you'll have huge wild and crazy values.
Please define EXACTLY what "those data are not fit to my given curve" means by showing a screenshot of what you did .
2 件のコメント
Walter Roberson
2014 年 4 月 14 日
If you have exact measurements for N positions and N corresponding datapoints, and if you have indefinite precision calculations, then you can construct a polygon of order (N-1) that will fit all of the points perfectly.
In some cases you might also be able to find an exact fit of lower order. Is that the situation for you, that you suspect that there might be some redundant points?
Note that if your data is a finite truncation of infinite values, or if you have any round-off error in the calculation that generated the y, or if even the slightest bit of noise, then finding the redundant points can be spoiled. And if you do not use indefinite precision arithmetic in doing to operations upon the coefficients that you find, then you might end up with a very large error between the predicted values and the actual values.
As a "rule of thumb", by the time you get to order 8 polynomials (9 points) then round off in finite arithmetic will result in inexcusable errors in doing projections. Lower orders will have notable errors as well. Some people say that if you are fitting at higher than order 4 then you are probably making a mistake if you are relying on double precision.
参考
カテゴリ
Help Center および File Exchange で Least Squares についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!