I obtained some data from an experiment. I fitted the data using the Mat lab fitting tool , but I unable to get the curve back ?

1 view (last 30 days)
Please refer the image :-
Blue line : Experimental data Red line : 6th order fit using fitting tool of Matlab ( equation displayed on the window )
( Equation : y = - 6.1e-11*x^{6} + 5.9e-09*x^{5} - 2.1e-07*x^{4} + 3.5e-06*x^{3} - 2.3e-05*x^{2} + 2.8e-05*x + 0.00045 )
So I went back to Matlab to check if this correct ...so I typed :
>> x = [ 0 : 0.01 : 32];
>> y =(( - 6.1e-11.*x.^(6)) + (5.9e-09.*x.^(5)) - (2.1e-07.*x.^(4)) + (3.5e-06.*x.^(3))-(2.3e-05.*x.^(2)) + (2.8e-05.*x) +( 0.00045));
>> plot(x,y)
I am getting the black curve ... Is it the problem with small coefficients of the polynomials ? Please help!

Answers (1)

Star Strider
Star Strider on 22 Nov 2014
I suspect you’re correct. The curve fitting tool is significantly truncating the precision of the coefficients it presents to you to two significant figures, while it keeps — and calculates — using full double precision maths it has available to it. I am not surprised that a truncated version of the coefficients and constants produces a different curve from the full precision calculations, although I would not expect it to be so extreme a deviation as it is.
  2 Comments
Suhas
Suhas on 22 Nov 2014
Thanks for your input...The curve fitting tool does have the option to select number of significant digits. I did not try for 6th order but my 4th order with 5 significant digits sits on the curve perfectly.I was very surprised with the deviation myself!
Star Strider
Star Strider on 22 Nov 2014
My pleasure!
I don’t have the Curve Fitting Toolbox (Statistics and Optimization Toolboxes make it redundant for me), so I thought you were simply cutting and pasting the display from the output. I always suggest using the full precision for all calculations, although truncating them to the appropriate number of significant digits for publication purposes is appropriate.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!