Can't reproduce original data from curve fit function

43 views (last 30 days)
I am using matlab cftool to fit a X vs Y set of data. Both X and Y are 1D arrays. The curve generated by the cftool visually fits the data well, and if I use the 'analysis' section of the cftool, I get Y_fit very close to Y. But if I get the fitting coefficients are generate Y_fit from them, the values are way off. Am I making any basic mistake? I am using polynomial curve fit scheme.
  2 Comments
Sean de Wolski
Sean de Wolski on 7 Mar 2014
How are you getting the coefficients?
Save the fit to workspace "Fit Menu" -> "Save to Workspace"
Then
fittedmodel.C
where C is your coefficient
Ram
Ram on 7 Mar 2014
Edited: Ram on 7 Mar 2014
The coefficients are displayed with 95% confidence bounds in the Fit Result window of the cftool application. I tried the way you suggested above and these are the exact coefficients I was using. I've attached my data sheet (res vs temp), and here are the results from fit:
Linear model Poly5:
f(x) = p1*x^5 + p2*x^4 + p3*x^3 + p4*x^2 + p5*x + p6
Coefficients (with 95% confidence bounds):
p1 = -22.29 (-27.5, -17.08)
p2 = 356.9 (280.5, 433.2)
p3 = -2321 (-2766, -1875)
p4 = 7696 (6405, 8988)
p5 = -1.308e+004 (-1.495e+004, -1.122e+004)
p6 = 9165 (8094, 1.024e+004)
Goodness of fit:
SSE: 0.4659
R-square: 1
Adjusted R-square: 1
RMSE: 0.08739
When I use these coefficients to calculate the values back, they are very much off from those generated by the 'analysis' section in cftool application (.fig attached)

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!