MATLAB doing wrong polynomial fitting
古いコメントを表示
Hello guys,
I have been doing some fittings lately. For this case I have a set of 55 points from which I'd like to obtain a good fitting. For simplicity I was trying a polynomial fitting with degree = 9. The graph matlab generated was this:

And the coefficients were these:
Linear model Poly9:
f(x) = p1*x^9 + p2*x^8 + p3*x^7 + p4*x^6 +
p5*x^5 + p6*x^4 + p7*x^3 + p8*x^2 + p9*x + p10
Coefficients (with 95% confidence bounds):
p1 = -5.012e-21 (-8.177e-21, -1.848e-21)
p2 = 2.014e-17 (7.065e-18, 3.322e-17)
p3 = -3.562e-14 (-5.94e-14, -1.184e-14)
p4 = 3.637e-11 (1.14e-11, 6.135e-11)
p5 = -2.363e-08 (-4.032e-08, -6.943e-09)
p6 = 1.013e-05 (2.772e-06, 1.749e-05)
p7 = -0.002864 (-0.005003, -0.0007243)
p8 = 0.5149 (0.1193, 0.9105)
p9 = -53.42 (-95.63, -11.21)
p10 = 2437 (457.4, 4417)
Goodness of fit:
SSE: 0.003537
R-square: 0.9978
Adjusted R-square: 0.9974
RMSE: 0.008865
So far, so good, the results should be between 1 and 0.3, however when i tested a random value in the polynomial itself, like 300, the result was above 3, indicating the fitting was wrong. Here is the graph generated using Maple with the coefficients from Matlab:

As we can see, the graphs are totally not connected. Honestly, I have never seen something like this and i have spent all day trying to figure this out. The fitting was done with Robust = off and no center and scale (I've tried that too, experiencing the same problems). I hope you guys can help me.
2 件のコメント
Walter Roberson
2015 年 12 月 12 日
Please post the x and y coordinates.
Pedro Rafael Guaraldi da Silva
2015 年 12 月 12 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Polynomials についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!