Obtaining close results with and without using MultiStart and GlobalSearch for fitting data to a non-linear model

2 views (last 30 days)
I am trying to fit an experimental data to a nonlinear model. I tried curvefitting tool and used "trust-region" algorithm but by changing the startingpoints the result was not changing and I was getting fitting parameter values inconsistence with the physics of the problem. Then, I tried "Levenberg-Marquardt" algorithm and I see the obtained fitting parametes change even with small changes in the startingpoints. So, I thought it might be helpful to see how things change by using multistart and globalsearch which use different startpoints. Also, I thought because I do have access to more algorithms in the optimization toolbox that might be helpful.
Now, I have written my codes in optimization toolbox and I have used "lsqcurvefit", "lsqnonlin" and also "fmincon" with multistart and also "fmincon" with globalsearch. I have tried almost all the algorithms of each solver for both local solver and also in the multistart and globalsearch. What I see is by using the same startingpoints I see close or same results for both local solver and multistart (globalsearch). And the estimated error doesn't change that much by using multistart (globalsearch). I am wondering does this mean that for my function the local and global minima are the same? If yes, so why I see my result is changing by changing startpoints when using "levenberg-Marquardt" algorithm in curvefitting tool (Also by using some other algorithms like "sqp" in optimization tool) or is there a problem that I don't figure it out?
Also, I see the result of the multistart changes with changing the startpoints which is not expected because multistart searches for global optima and so the result should not be dependent on the startingpoint similar to local solvers. I am wondering why is that?
I have attached the code for my "lsqcurvefit" together with "multistart" trial and two series of my data for reference.
Thank you in advance!

Answers (1)

Matt J
Matt J on 24 Apr 2022
Edited: Matt J on 24 Apr 2022
I am wondering does this mean that for my function the local and global minima are the same?
It might, but there's never any guarantee of that. Both the local and global solvers can fail. You haven't mentioned what exitflags are reported, but even the exitflag is the solver's best guess at whether a solution was found.
If yes, so why I see my result is changing by changing startpoints when using "levenberg-Marquardt" algorithm in curvefitting tool
There may be multiple solutions. Or, you might be getting stuck in a startpoint-dependent local minimum.
Also, I see the result of the multistart changes with changing the startpoints which is not expected because multistart searches for global optima and so the result should not be dependent on the startingpoint similar to local solvers.
Again, there's no guarantee of that when you have multiple global minima. Consider the function f(x)=1. Here, any startpoint is a global minium, so changing the startpoint(s) will give you different solutions every time.
  8 Comments
Shaily_T
Shaily_T on 27 Apr 2022
Edited: Shaily_T on 27 Apr 2022
Thank you so much!
I just had a look there.
I have already tried parameter sweep in my case (not using grid search but by changing the parameters manually in the function to see the results) and indeed I have not seen an improvement in the fitted curve. I am wondering do you think even in this case it might be helpful to do a grid search for the initial points of my function?
I have posted a question here about my actual problem for fitting these data to my model function and in the comment I have elaborated more on my function and problem: https://www.mathworks.com/matlabcentral/answers/1704170-getting-inconsistent-results-for-fitting-different-series-of-data-to-a-nonlinear-function?s_tid=mlc_ans_email_view#answer_950110
I apprecitae your time and thank you in advance!
Shaily_T
Shaily_T on 10 May 2022
Hi again @Matt J
For your suggestion of doing a grid search for the global minima, I tried to plot the function that I want to optimize vs two of my fitting parameters (so, the other two are constant) to have a sense of what is going on. I have attached the obtained surfplot (SSE is the function to be minimized, a, d, sigma are parameters that I want to obtain by minimization). I am wondering do you think if a grid search would be helpful in my case?
I apreciate your comment!

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!