Problem with fsolve in a minimization algorithm

조회 수: 1 (최근 30일)
Riccardo Rinaldi
Riccardo Rinaldi 2018년 11월 13일
I have a problem with fsolve function. In particular, I have written a code which minimizes a function (called OBJECTIVE FUNCTION, line 433) so that the difference between the experimental values (yCH4out, lines 98 - 106) and the ones obtained by the solution of an ODE system (lines 328 - 368) is minimized. This ODE system depends on a variable, called K_CO, which is computed from the solution of an fsolve function, find_K_CO, (lines 437 - 443). The value of K_CO is to be obtained for every step of the integration in the ODE system, as it depends on P_CO, which changes as the integration moves on. So, the fsolve function should zero the equation for each integration step. I am quite sure that the error is inside the fsolve function (ines 437 - 443), as the remaining part of the code works if a constant value of K_CO is assumed. I think that the error comes from the way I have expressed all the variables the equation I want to nullify depends on: the ones listed in the global (line 439) or T (line 437).
Thank you very much in advance.
RIccardo Rinaldi.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by