I have a coupled second order DE; how to solve them with boundary conditions; How to get get F1 and F2

3 views (last 30 days)
equation 1: d^2f1/dx^2-Q/K1*F1+P/K1=0
equation 2 d^2f2/dx^2-Q/K1*F2+P/K2=0 Boundary conditions F1(0)=0 F2(l)=P F1(l-u)=F2(l-u) dF1/dx(l-u)=dF2/dx(l-u) PS All variables l, u, P,Q and K1 are known

Answers (1)

Torsten
Torsten on 28 Sep 2017
Use "bvp4c" with the "multipoint boundary value problem" facility:
https://de.mathworks.com/help/matlab/ref/bvp4c.html#bt5uooc-23
https://de.mathworks.com/help/matlab/math/boundary-value-problems.html#brfhdsd-1
Best wishes
Torsten.
  2 Comments
Torsten
Torsten on 2 Oct 2017
Edited: Torsten on 2 Oct 2017
function dydx = f(x,y,region)
P = ...;
Q = ...;
K1 = ...;
K2 = ...;
dydx = zeros(2,1);
dydx(1) = y(2);
% The definition of dydx(2) depends on the region.
switch region
case 1 % x in [0 l-u]
dydx(2) = y(1)*Q/K1-P/K1
case 2 % x in [l-u l]
dydx(2) = y(1)*Q/K1-P/K2;
end
function res = bc(YL,YR)
P=...;
res = [YL(1,1) % y(0) = 0
YR(1,1) - YL(1,2) % Continuity of F(x) at x=l-u
YR(2,1) - YL(2,2) % Continuity of dF/dx at x=l-u
YR(1,end) - P]; % y(l) = P
You should be able to add initial conditions and call "bvp4c" following the example in my above link.
Of course, you will have to give values to the parameters used in the function routines.
Best wishes
Torsten.

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!