Simultaneous Constant Optimisation for Curve Fitting

61 views (last 30 days)
TheGymnopedist
TheGymnopedist on 12 Apr 2024 at 9:43
Commented: Torsten on 12 Apr 2024 at 17:13
I have a set of 15 constants which I need to optimise to obtain a minimum WSSE (error). These constants are part of a function file which is called by an ode solver to model the concentration of different species over time, and this modelled data is compared to experimental data, so that the optimum value of the 15 constants can be determined.
Any advice on how to achieve this would be much appreciated, as doing it manually has led to finding local minimums.
EDIT: Extra info in comment.

Answers (1)

John D'Errico
John D'Errico on 12 Apr 2024 at 11:32
Edited: John D'Errico on 12 Apr 2024 at 11:37
Do NOT manually search through a 15 dimensional space for a solution. You are just wasting your time, and this is why tools are provided to perform optimization and such searches for you.
Use a look like nlinfit, or lsqcurvefit, or lsqnonlin. Many others too, but that is where you should be looking.
Since you comment about finding local mins, recognize that even such a tool will NOT guarantee finding a globally optimal solution. It can easily stop in a local min, as long as the local minimum does not have any direction to move to that offers an improvement in the objective. This is a function of choosing good starting values for the search. Choose crappy starting values, or even random ones, and expect randomly crappy results.
Despite the many people who plead for a way to automatically choose good starting values, that is an impossible task. Sorry. At best you can use a tool like GA to perform the search. It can improve your results, though it will take more time to perform the search.
Since I know you will ask for a direct example on how to use those tools for your problem, READ THE HELP FOR THE TOOL YOU WILL TRY TO USE. All of those tools have examples of use already provided.
  2 Comments
TheGymnopedist
TheGymnopedist on 12 Apr 2024 at 13:51
Hi John, thanks for the advice so far. I have come across these tools in my search; however, I am not sure how to implement them when using a system of odes. lsqcurvefit seems the most promising; however, I am unsure as to how the intital guesses for the constants are assigned to the correct constants (ka1-ka15) in the function file.
The example shows x(1) & x(2) being used to denote the variables to optimise; however, as my function file (dmdt) is a system of odes, m(1)-m(17) are the system of odes, not the select constants used in those odes.
From the examples, it would appear that the initial guesses will therefore be taken to be the initial guesses to the system of odes (generating the 17 curves), not the constants themselves. Any advice on how to amend for this?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!