Clear Filters
Clear Filters

cftool two term exponential curve fit doesn't make sense

6 views (last 30 days)
Hey all. So I'm curve fitting some experimental data in MatLAB using the cftool. This is in R2014b. I'm fitting my data to a two term exponential function such that f(x) = a*exp(b*x) + c*exp(d*x). The curve on the plot looks good. My R squared values are 0.99 . . . but the coefficients make no sense.
a = 4.097e+07
b = -4.806
c = -4.097e+07
d = -4.806
Based on the above formula for a two term exponential, for an x value f(x) = 0. I can't extract these coefficients and use them elsewhere because they don't make sense and they don't produce the curve fit that cftool graphs that has the R^2 = 0.99 . . . Am I missing something?

Accepted Answer

John D'Errico
John D'Errico on 26 Mar 2015
It is good to think about the parameters that come back. Does what you got make sense? Never just accept what a computer gives you without applying a mental filter to it.
So, what has happened here? It turns out that IF you look carefully at the parameters, to full precision, you will see a difference. The differences between those terms is tiny, and with those huge coefficients, it tells me that the solver managed to overfit the problem. Sadly, this fit is meaningless, and I would argue useless. You might as well use a spline, or some other tool.
If you really are wedded to an exponential model BECAUSE the parameters are necessary for other purposes, then these coefficients are useless anyway. They have no meaning, EXCEPT that they managed to squeeze a slightly lower residual error out of the model, FOR that set of data. Yes, sometimes people need a rate parameter from a model, and this is why they use an exponential model. But those model parameters offer no meaning at all in that context.
I'd prefer to play with the data (or at least look at it) before trying to suggest a better model. But essentially, if your goal is purely to get a good fit, then use a tool that can fit your data well instead of trying to force an exponential model to fit by just throwing extra parameters at the curve fit. My suggestion would probably be a spline model, specifically my SLM toolbox (found on the File Exchange), because you can control the basic shape of that curve.

More Answers (1)

Star Strider
Star Strider on 26 Mar 2015
We can’t see all the digits in the coefficients you posted. Are they truly equal? Perhaps you only need one exponential.
  2 Comments
Matthew Pollard
Matthew Pollard on 26 Mar 2015
With one exponential term, my R^2 = 0.97. I need a better curve fit than that, hence using the two term curve fit. Is there a way to see more decimal places on the coefficients?
Star Strider
Star Strider on 26 Mar 2015
I can’t imagine that you would need an value higher than 0.97 with real-world data. The criteria of interest are the residual sum-of-squares, and more importantly, the confidence intervals of the parameters.
Pay close attention to the confidence intervals of the parameters. If any of them include zero (one positive an one negative) that parameter is not needed in the model. That will tell you if you need all the parameters from both exponentials.
You can get more figures in the coefficients (and everything else) by choosing format long e in the Command Window or your script file.

Sign in to comment.

Categories

Find more on Interpolation in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!