Numerical solution to an ODE as input to solve another ODE?

I have the following ordinary differential equation (ODE):
where, y is given by the solution to
(f and g denote functions)
If the second ODE has an analytic solution, solving the first ODE numerically, for example using ODE45, is straight forward as can be substituted.
However, if an analytic solution for y is not available, how can I use the numerical solution to the second ODE as input to the first ODE? Or is there any other way to solve the problem?

 Respuesta aceptada

Torsten
Torsten el 29 de Nov. de 2018
Solve
dy/dt (= dy/dx * dx/dt) = g(y,x)*f(y,x)
dx/dt = f(y,x)
together using ODE45.

2 comentarios

Thanks Torsten. That works perfectly.
I have a related question: is there a way to impose constraints on the variables ? For example .
No, the functions f and g and the initial conditions for x and y uniquely determine the solution. Thus the solution is already fixed in advance - no chance to impose constraints.
If the solution for x exceeds the bounds you listed for x because of numerical errors, you might try to strengthen the tolerances of the solver.
Best wishes
Torsten.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Preguntada:

el 28 de Nov. de 2018

Comentada:

el 4 de Dic. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by