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

1 Ansicht (letzte 30 Tage)
Hi,
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.
Thanks

Akzeptierte Antwort

Matt J
Matt J am 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,
parameters1=dofit1(initialguess1);
initialguess2=parameters1;
Parameters2 = dofit2(initialGuess2)

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by