Problem of complex solution combining lsqnonlin solver with ode45
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I'm developing a kinetic model that has to fit some experimental data. The expression for the reaction rates are based on 8 parameters.
I'm using ode45 to integrate the system of ODEs and lsqnonlin to tune the 8 parameters minimising the error with the experimental data.
The moodel is way too dependent on the first guess and it is not possible to add some constrains to the parameters.
Running the code I'm obtaining complex solutions from the ODE system and, as a result, the model does not converge.
Thanks in advance!
0 Commenti
Risposta accettata
Matt J
il 29 Ago 2022
Modificato: Matt J
il 29 Ago 2022
If you are getting complex solutions, it means that one of the calls to your objective function was given a real input, x, but returned a complex-valued result. Often this happens because of the presence of sqrt(z) or log(z) operations in the objective function, which will return complex results for z<0. You should trap the occurrence of the complex value with a conditional breakpoint to get a clearer idea when and why this occurs.
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su General Applications in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!