Problem of complex solution combining lsqnonlin solver with ode45

1 vue (au cours des 30 derniers jours)
Luca Vergani
Luca Vergani le 29 Août 2022
Modifié(e) : Matt J le 29 Août 2022
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!

Réponse acceptée

Matt J
Matt J le 29 Août 2022
Modifié(e) : Matt J le 29 Août 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.

Plus de réponses (0)

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by