Curve fitting via optimization without toolbox

7 views (last 30 days)
Hello,
I have a data sheet with the following curve data.
time 1.00E-03 0.01 0.04 0.1 1 10
Zth(t) 0.007 0.02 0.04 0.055 0.09 0.1
The equation of the curve is as following:
Equation: Zth(t) = R1*(1-exp(-t/tau1)+R2*(1-exp(-t/tau2)+R3*(1-exp(-t/tau3)
I need to fit the curve on matlab to the measured curve and thus estimate the R1-R3 and Tau1-Tau3 values by optimization.
The matlab version I have does not have a curve fitting or optimization toolbox. Can I get some assistance with the procedure to do it purely on matlab??
Thank you.

Answers (1)

John D'Errico
John D'Errico on 12 Jun 2014
Sorry, but this is INSANE.
You want to fit a sum of THREE exponentials (so 6 coefficients), from 6 data points?
Given that sums of multiple exponentials are a difficult problem to estimate in general, what you want to do is essentially a random number generator. I.e., it will generate arbitrarily meaningless coefficients.
Save your energy. Get better data. LOTS more. Even then, make sure you have good starting values. (You won't.)
John
  6 Comments
José-Luis
José-Luis on 12 Jun 2014
If the numbers don't matter then why don't you do it the other way around? Define your function and then get some points on it, which boils down to simple function evaluation. And also that would be a perfect fit.
John D'Errico
John D'Errico on 13 Jun 2014
Exactly. If the numbers themselves as a solution are irrelevant, then just pick some. You don't need to do any optimization, especially an optimization that will likely be poorly conditioned.
You seem to think that just because Excel returned a solution, that it is the "correct" one. Excel returned a set of numbers that its own optimizer stopped at. For us to try to help you stumble through solving a moderately nasty problem would be a waste of our time and yours, especially since you seem to know only a wee bit about optimization.
You would likely find out that the solution is dependent on your starting values, although one answer might be nearly as good as another. Or you might wonder why the solution that Excel returned was a different one from what you find in MATLAB, and then we would need to go through iterations explaining why, or why you don't care anyway. Or you might find that the optimizer seems to diverge sometimes, again depending on starting values.
And finally, for us to wean you through all of this when you don't even have the logical toolboxes one might use is even more a waste of energy when you don't need any help at all.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!