Why does "lsqnonlin" generates the result for 'x' that is equal to initial value 'x0'?

1 view (last 30 days)
In my MATLAB code, I use "lsqnonlin" to find the three parameters that would match the experimental curve. Using the “ode45” version in MATLAB, "lsqnonlin" generates the values for "x" that are equal to the initial values from "x0" and therefore it is not able to match the experimental data. Why using ode45 it is not able to match the experimental curve?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Dec 2021
Regarding a better fit result, I was able to get a better match by changing a few solver parameters as follows:
options = optimoptions('lsqnonlin','Algorithm','Levenberg-Marquardt','FiniteDifferenceType','central','FiniteDifferenceStepSize',1e-2);
The main point is:
  1. The algorithm has a notable effect on how the solver moves and stops. Levenberg-Marquardt is more effective in this case.
  2. The finite-difference derivative estimates from "lsqnonlin" are not reliable. I'm fairly sure it's because there is non-smoothness in the function. The finite-difference options I changed were an attempt to "smooth" out the estimation process. 
  3. This page is a very useful resource for optimization of ODE simulations that covers this topic and more: https://www.mathworks.com/help/optim/ug/optimizing-a-simulation-or-ordinary-differential-equation.html

More Answers (0)

Tags

No tags entered yet.

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!