Using ode45 to solve system of ODEs with some initial conditions and some terminal conditions

4 Ansichten (letzte 30 Tage)
I have a system of ODEs with , and with a mix of initial and terminal conditions on x. Specifically, for the first 8 components of x, we have the initial conditons, , while for the last 8 components, we have terminal conditions, . Mathematically, this should be enough to guarantee uniqueness of the solution, and I know that if you ever have only terminal or only initial conditions, ode45 handles it no problem.
The first thought would be to just separate the first 8 and last 8 components and just solve 2 system of ODEs, one with terminal conditions and the other with initial conditions, but unfortunately the equations governing both the first 8 components and the last 8 all involve all 16 components, so separating them out isn't possible.
Basically, I want to know if theres a way to corral ode45 into solving a system of ODEs such as this one, since I couldn't find a built-in way to do it when searching, or if there's some mathematical trick to where I can transform the system to only have initial conditions, or something like that.
Any help is appreciated!

Akzeptierte Antwort

Torsten
Torsten am 8 Jul. 2022
This is a boundary-value problem.
Use BVP4C or BVP5C instead of ODE45.
  2 Kommentare
Christian
Christian am 12 Jul. 2022
Bearbeitet: Christian am 12 Jul. 2022
Awesome, reading the docs looks like that would work, thanks for the fast reply. The MATLAB docs and YouTube videos I tried to watch on bvp4c and bvp5c have only had very basic examples, so I've been having a hard time figuring out all the parameters that bvp4c and bvp5c require but which ode45 does not - specifically the boundary condition function, the bvpinit parameter, and the region parameter, which I guess is pretty much everything new. In my case, is piecewise smooth on 5 different regions, separated by , so the region parameter should be 5 as far as I can tell. But would you mind showing me an example of how I should go about coding f, the boundary conditon function, and the bvpinit to account for the regions and so that bvp4c or bvp5c would accept it? Thanks in advance again

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by