Curve fitting tool generating different results with same data

36 Ansichten (letzte 30 Tage)
ellsss
ellsss am 17 Aug. 2018
Kommentiert: Matt J am 28 Apr. 2019
I have been using the Curve fitting tool (cftool) to generate best fit equations for real-life data that generally follows exponential decay kinetics with a 'floor', with the equation in the form f(x) = a*exp(-bx) + c. I did my initial data analysis in the spring of 2018 and now have gone back to redo some of the work. Now I am getting different values for the parameters of the equation than I did on the first analysis, although the input data is not changed. I used the curve fitting tool to set certain bounds for the equation (specifically c >/= 0) on both occasions, and although I think I have done everything the exact same, I am not getting the same results for the curve fitting parameters. Has something changed in the curve fitting algorithm or is there a setting that I can change?
  3 Kommentare
ellsss
ellsss am 21 Aug. 2018
Yes, this solved the problem. Looking back on my notes, I had actually fixed fairly tight bounds for the parameters, which affected the rest of the results. I was able to reproduce the original results once I fixed the bounds in the same way. Thanks again.
Matt J
Matt J am 28 Apr. 2019
Jeffrey Newbill's comment moved here:
Sorry for resurrecting an old comment thread, but I'd like to add in that I right now have a data set that generates new unique values every time I plug in that same data. To clarify, simply reselecting the same variable in the "X data" drop down menu produces a new (though loosely similar) parameter value. I'm not sure why or how, but there are cases where MATLAB produces different results for the same input.

Melden Sie sich an, um zu kommentieren.

Antworten (2)

John D'Errico
John D'Errico am 28 Apr. 2019
Bearbeitet: John D'Errico am 28 Apr. 2019
Has nobody answered this question? The common reason why a method produces different results on a repeated start is there was a random element in the method. In the case of the curve fitting toolbox, if you do not specify the starting point for the estimation, then fit uses a RANDOM start point.
If you start ANY optimizer off from a different point, then you need to expect at least slightly different results. The difference may be as small as the convergence tolerances allow. Or, it may be worse, if the problem has multiple local solutions. Sometimes they are all equivalent, although not always. The point is, this is behavior that you SHOULD EXPECT TO SEE HAPPEN. It is entirely natural. Occasionally, your data is so poor that the model is underspecified. In that case, you might see multiple solutions. In the case of such insuffiicent data, then you need to get better data. The hint in this last case is usually that you get many warning messages produced, probably about singular or nearly singular matrices.
Can you avoid such problems? (Assuming your data is at least viable to produce a solution.) That is, can you get the same solution each time? There are two ways to resolve it, if this really bothers you.
  1. Best is to just provide intelligent starting values of your own. That makes it most possible that you will get a viable solution. Even if you cannot provide something intelligently chosen, then a set of fixed values is an option.
  2. If you cannot provide starting values at all, then set the starting random seed for the random number generator.

ellsss
ellsss am 17 Aug. 2018
The version change was actually the first thing I tried. I have access to both 2017a and 2018a from my university so I tested the data in both version, I get the same results from both versions which are different from my original. I have been playing around with the starting points without success so far, but I will keep trying.
  1 Kommentar
ADragon
ADragon am 17 Aug. 2018
If you have the previous constants you can try to narrow the bounds around the known values. If you get a good fit, slowly open the bounds until you get a clue of where the algorithm might go wrong. Good luck! Hope it works out.
AD

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Get Started with Curve Fitting Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by