Applying Boundary Condition to ODE45

14 views (last 30 days)
Hi all,
I have a set of coupled differential equations which are readily arranged to be solved on ode45 in a domain [0 L]. However, all the boundary conditions of the differential equations are given at x=L instead of x=0. I cannot enforce these BCs to my problem using MATLAB. How can i accomplish that ? (I would like to solve set of ODEs using 4th order Runge Katta Method)
Kind Regards

Accepted Answer

Stephan
Stephan on 21 Apr 2019
Edited: Stephan on 21 Apr 2019
Hi,
you can reverse tspan. If you for example use:
tspan = [20 0]
then the integration will be backwards and your condition is an initial condition.
Best regards
Stephan
  2 Comments
Oguz Altunkas
Oguz Altunkas on 21 Apr 2019
was it that simple :D thanks alot Stephen
Maomao Wang
Maomao Wang on 28 Mar 2021
Awesome, that works, thanks alot Stephen.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!