Problem of complex solution combining lsqnonlin solver with ode45
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Luca Vergani
am 29 Aug. 2022
Bearbeitet: Matt J
am 29 Aug. 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!
0 Kommentare
Akzeptierte Antwort
Matt J
am 29 Aug. 2022
Bearbeitet: Matt J
am 29 Aug. 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu General Applications finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!