Problem with fsolve in a minimization algorithm
1 view (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!