Parameter fitting problem: I use lsqnonlin to fit 3 parameters into a system of ODES and everything works fine until I inserted a Confidence Interval as one of my coefficients.At that point the fitted parameter vector took only the initial guess
4 views (last 30 days)
Show older comments
helen flountzi
on 9 Nov 2018
Answered: george hargenrader
on 11 Nov 2020
Parameter fitting problem: I use lsqnonlin to fit 3 parameters into a system of ODES and everything works fine until I inserted a Confidence Interval as one of my coefficients.At that point the fitted parameter vector took only the initial guess
2 Comments
Torsten
on 9 Nov 2018
Edited: Torsten
on 9 Nov 2018
Commented by Helen Flountzi:
For example, this is one of my ODEs: dy(1)=h*(1-z)*N-lamda0*nsp_r*y(1)-(m+q)*y(1)+param2*y(4); if I replace z with z=0.289+(0.615-0.289)*rand; my fitting process provides as solution the initial param2(0)that I gave initially(I already tried to change the initial values &still the same)
Accepted Answer
Torsten
on 9 Nov 2018
Edited: Torsten
on 9 Nov 2018
Each time your ODE function is called, "rand" takes a different value between 0 and 1. This makes it impossible for the ODE solver to get a solution of your ODE and for the fitting tool to determine optimal parameters. So it gives up and returns the initial guesses.
Call the fitting tool for different, but fixed values for z in a loop and see how the optimal parameters change.
Best wishes
Torsten.
4 Comments
Torsten
on 13 Nov 2018
Edited: Torsten
on 13 Nov 2018
Somewhere in your code you have to call "lsqnonlin". That's where you have to insert the above loop. This way, z_actual is passed to the function "fun_lsqnonlin" of lsqnonlin. In this function, you somehow have to call an ODE integrator (e.g. ODE45). Pass z_actual a second time to the function "fun_ODE_integrator" where you define your ODE in the same way as you did for lsqnonlin. Then you can use z_actual as coefficient in your ODE function.
Or, although usually not recommended: Define z_actual as global and insert
global z_actual
in the function where you call lsqnonlin and in the function where you supply the ODE.
More Answers (1)
george hargenrader
on 11 Nov 2020
How does inserting a range of starting values for one parameter equate to a confidence interval? What information do you gain by doing this?
0 Comments
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!