Why does Curve Fitting Toolbox produce a good exponential fit graph with a wrong equation?
Show older comments
Hello everyone,
I have created a graph for my data points using second order exponent (a * exp(bx) + c * exp(dx)). You can see it on the first picture. It looks good to me, there is no problem with the graph. However, I need to get the equation of this graph and that is where the problem comes out.
On the second picture you can see the constants for my equation with unusually large 95% confidence bounds. The graph shows these boundaries to be very small, almost insignificant. Also if I plug in some value of x in the equation and the graph, for example x=25, the results are very different:
Equation: -1.297 * exp(-2.486 * 25) + 1.325 * exp(-2.48 * 25) = 2.47 * 10^-20
Graph: at x = 25, y = 0.183 (shown on the first picture)
You can find my variables by clicking on this link and downloading the excel file.
https://drive.google.com/file/d/1YVOYX0Mno68Ab5pr53ytZEC5_GuEKC6H/view?usp=sharing
The value on the graph is correct. My question is what is the problem and how can I solve it?
7 Comments
Birdman
on 21 Dec 2017
Why describing it with two exponential term? One exponential term makes me think that it should also do it for you.
David Verrelli
on 21 Dec 2017
I think Birdman has made a good point. Both of your exponents are similar.
Suppose that the 'true' equation should be 0.027*exp(-2.483 * t).
If you request a fit of the form A*exp(B*t), then the respective confidence intervals on A and B should be small.
But if you request a fit of the form A*exp(B*t) + C*exp(D*t), then valid fits include:
- (0.027)*exp(-2.483 * t) + (0.000)*exp(-2.483 * t)
- (1.027)*exp(-2.483 * t) + (-1.000)*exp(-2.483 * t)
- (100.027)*exp(-2.483 * t) + (-100.000)*exp(-2.483 * t)
- (-0.973)*exp(-2.483 * t) + (+1.000)*exp(-2.483 * t)
- (0.000)*exp(-2.483 * t) + (0.027)*exp(-2.483 * t)
- et cetera
Those are all mathematically identical! Therefore the C.I's on A and C would be very, very wide. (In your case, due to the specific numeric details you also obtained wide C.I's on B and D.)
Lastly, the erroneous value of 2.47 * 10^-20 that you calculated from the equation is almost certainly arising due to rounding error, as the parameter estimates are only printed in your output with a maximum of 3 decimal places. Presumably this can be adjusted to see more decimal places. Try the format long command, perhaps.
—DIV
Boleslav Tiunkov
on 21 Dec 2017
Birdman
on 21 Dec 2017
Can you share your fitting data in a mat file?
Boleslav Tiunkov
on 21 Dec 2017
Boleslav Tiunkov
on 21 Dec 2017
John D'Errico
on 21 Dec 2017
Why is it a problem to save it?
save mymatfile X Y
That will save a .mat file in your current directly, assuming you have write access to that directory. So WTP?
Accepted Answer
More Answers (0)
Categories
Find more on Descriptive Statistics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!