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?

 채택된 답변

Torsten
Torsten 2018년 11월 29일

1 개 추천

Solve
dy/dt (= dy/dx * dx/dt) = g(y,x)*f(y,x)
dx/dt = f(y,x)
together using ODE45.

댓글 수: 2

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.

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

추가 답변 (0개)

카테고리

태그

질문:

2018년 11월 28일

댓글:

2018년 12월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by