Problem of complex solution combining lsqnonlin solver with ode45

2 ビュー (過去 30 日間)
Luca Vergani
Luca Vergani 2022 年 8 月 29 日
編集済み: Matt J 2022 年 8 月 29 日
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!

採用された回答

Matt J
Matt J 2022 年 8 月 29 日
編集済み: Matt J 2022 年 8 月 29 日
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 件)

カテゴリ

Help Center および File ExchangeGeneral Applications についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by