MATLAB Answers

Passing parameter values found in lsqcurvefit to be initial values for parameter estimation in another function

1 view (last 30 days)
Can anyone help please? I have estimated the parameters for an ODE model, theta(1) to theta(12), using lsqcurvefit. I want to use the results as initial 'guesses' for the parameters in another slightly different ODE model where I also need to estimate the parameters. It is slightly complicated that this second ODE model has 15 parameters. I want to start the last three at 1.
At the moment I am copying and pasting the found parameter values into the initial values theta0 in the second script. Is there any way to call the parameters found by running the first script to use in the second?
I hope that makes sense. I haven't included any code since it is just the one line of code I need help with, and I don't know where to start. Please let me know if there is any code you need to see.


Sign in to comment.

Accepted Answer

Matt J
Matt J on 15 Feb 2020
Some possibilities,
  1. Combine the code from both fitting steps into a single script. That way you will have direct access to the output of the first fit.
  2. Put each fit into its own mfunction. Write the functions to takes an initial guess as input (along with other arguments, perhaps) and returns the fit parameters as output. Then in a main file do,
Parameters2 = dofit2(initialGuess2)

More Answers (0)

Sign in to answer this question.