MATLAB Answers

# Solve differential equation system with ode45

118 views (last 30 days)
Nico Lange on 28 Dec 2020
Commented: J. Alex Lee on 3 Jan 2021
Hello there,
I don't know if this is more of a mathematical problem or a programming problem...
I have the following differential equation system:
2*F+H'=0
F²+F'*H-G²-F''=0
2*F*G+H*G'-G''=0
with initial Parameters
1. F=0, G=1, H=0
2. F=0, G=0
I want to solve this with ode45 and plot the result. It should look like in the image (by Schlichting-Gersten).
How can i solve this? ##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### Answers (2)

J. Alex Lee on 28 Dec 2020
If you want to use ode45, then you have to pose as 5 first order ODEs in place of the 3 you have, by defining new variables J=G' and K=F', and then put them all in explicit form, i.e., X' = ...
Then read up on how to use ode45
##### 5 CommentsShowHide 4 older comments
J. Alex Lee on 30 Dec 2020
You should move your "Answer" back into these comments...
Well, ok, so P is only coupled to the system one-way, so you can compute it later, so strictly it is not necessary to include. But if you want to compute it even if it's not in the example solution curves, it's probably easier just to include in the system so that you don't have to post-process later.
I agree that the link you posted is relevant to find approximate solutions that are consistent with the infinite boundary situation that you have.
The "residual form" of any condition is to rearrange the equation in the form 0 = ...That way you can pose as a root-finding operation. Using bvp4/5c you won't need to worry about the details of how to solve that. On the other hand if you want to use shooting with ode45 or some variant, you will need to solve at a least a 2-dimensional root finding problem (for the 2 missing initial conditions at x=0). Bottom line, residual form is just equation rearranged so that the LHS is 0, and you replace zero with "res", which is the thing you are asking bvp4c to set to 0.
Based on your comments and questions, I would recommend learning how to use bvp4c rather than the other approaches I mentioned.

Sign in to comment.

Nico Lange on 30 Dec 2020
No, the full system of ODEs ist
2*F+H'=0
F²+F'*H-G²-F''=0
2*F*G+H*G'-G''=0
P'+H*H'-H''=0
with initial Parameters
x=0 => F=0, G=1, H=0, P=0
x=infinite => F=0, G=0
but I wasn't sure if i needed the last one. I just added it yesterday, just in case that it is necessary.
https://de.mathworks.com/help/matlab/math/verify-bvp-consistency-using-continuation.html
Yes there is an example, but I am not sure how to work with res = fsbc(), beacuse I never needed it and I don't know how to use the function with bvp4c. I also never worked with bvp4c before, so I am not sure how to use it correctly :'D
##### 5 CommentsShowHide 4 older comments
J. Alex Lee on 3 Jan 2021
it does you no good to add more odes... stick with the 5 ode's back when you didn't need the P and follow the examples of bvp4c/5c.

Sign in to comment.

### Community Treasure Hunt

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

Start Hunting!