Define an additional variable in ODE solver
2 ビュー (過去 30 日間)
古いコメントを表示
I need to solve a system of ODE's. There are two time dependent concentrations equations
dC1/dt= Const1 + Const2 * P1
dC2/dt= Const3 + Const4 * P2
P1=f(r)
P2=g(r)
r= h(C1,C2)
I need to calculate P1 and P2 with are functions of r. Then calculate r using the solution of the differential equations for the latest time step. For this I would need an initial value for r to be used in first timestep. As equation for r is not an ODE how can I prescribe an initial condition for it?
0 件のコメント
採用された回答
Star Strider
2021 年 11 月 26 日
This is all a bit confusing, since the differential equations are not them selves functions of ‘C1’ and ‘C2’, so a differential equation solver might not be necessary. Jus multiply ther RHS of those equations by the current value of ‘t’ an be done with it.
With respect to ‘r’ since it is a function of ‘C1’ and ‘C2’ that have initial conditions, calculate it, ‘P1’ and ‘P2’ first in each loop iteration.
At least, knowing only what is in the problem statement, that’s what I would do.
.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Ordinary Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!