Define an additional variable in ODE solver

3 visualizaciones (últimos 30 días)
Auwais Ahmed
Auwais Ahmed el 26 de Nov. de 2021
Respondida: Star Strider el 26 de Nov. de 2021
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?

Respuesta aceptada

Star Strider
Star Strider el 26 de Nov. de 2021
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.
.

Más respuestas (0)

Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by