stiff ode solver with non-negative properties

조회 수: 7 (최근 30일)
Xinyue Liang
Xinyue Liang 2022년 9월 12일
편집: Torsten 2022년 9월 12일
I looking to construct a model consisting of differential equations solved numerically using matlab. The results of the equations are pretty stiff, so only a stiff solver works. I am also hoping for the results to be set as non-negative to better match the empirical data. This does not seem to work with the standard ode solvers. Do you have any recommendations for this situation?

답변 (1개)

Torsten
Torsten 2022년 9월 12일
편집: Torsten 2022년 9월 12일
Do the negative solutions result from numerical inaccuracies or from the equations themselves ?
If the latter is the case, no recommendations can be given because the solution is determined by the ODEs and the initial conditions. If they turn out to be negative, then you must accept this.
Else try the NonNegative option in the ODE solver options (together with a stiff solver, e.g. ODE15S).
  댓글 수: 2
Torsten
Torsten 2022년 9월 12일
@Xinyue Liang comment moved here:
I think it results from numerical inaccuracies. The NonNegative option for the ODE solver does not seem to work for any of the stiff solvers (ode15, ode23). Is there another way to change this or maybe alter the equations to manually set it to be non-negative? Thank you so much!
Torsten
Torsten 2022년 9월 12일
편집: Torsten 2022년 9월 12일
If the NonNegative option does not work usually indicates that the negative values stem from the equations themselves, not from numerical inaccuracies...
Before working with the variables, you could check them for nonnegativity in an if-statement and reset them to a small positive value if they are negative. But this only works if they are really negative due to numerical inaccuracies. Otherwise, you will get unexpected solutions or the solver will quit.

댓글을 달려면 로그인하십시오.

카테고리

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

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by