Filter löschen
Filter löschen

Boundary value problem with 3 regions

1 Ansicht (letzte 30 Tage)
Jagadeesh Korukonda
Jagadeesh Korukonda am 25 Apr. 2020
Bearbeitet: Anadi Mondal am 6 Sep. 2022
Hello,
I have BVP with 3 region d²Y/dX²=constant
Region 1: [0,a] d²Y1/dX²=constant1
Region 2: [a,b] d²Y2/dX²=constant2
Region 3: [b,c] d²Y3/dX²=constant3
BCs: Y1(0)=Pc(constant)
Y1' = Y2' @x=a Y1 = Y2 @x=a
Y2' = Y3' @x=b Y2 = Y3 @x=b
Y3(c) = Pl (constant)
0<a<b<c
Help me in solve this problem using bvp5c

Akzeptierte Antwort

Ameer Hamza
Ameer Hamza am 25 Apr. 2020
This page has a detailed explanation for BVP with multiple boundary conditions: https://www.mathworks.com/help/matlab/math/solve-bvp-with-multiple-boundary-conditions.html
For your problem, try this code
a = 1;
b = 2;
c = 3;
x = [linspace(0,a,10) linspace(a,b,10) linspace(b,c,10)];
yinit = [1; 1];
x0 = bvpinit(x,yinit);
sol = bvp5c(@odeFun, @bcFun, x0);
function dydx = odeFun(x, y, r)
switch r
case 1
c = 0.2; % constant in region 1
case 2
c = 0.5; % constant in region 2
case 3
c = 0.3; % constant in region 3
end
dydx = [y(2); c];
end
function res = bcFun(YL, YR)
res = [YL(1,1); % Y1(0)=Pc(constant)
YR(1,1) - YL(1,2); % Y1 = Y2 @x=a
YR(2,1) - YL(2,2); % Y1' = Y2' @x=a
YR(1,2) - YL(1,3); % Y2 = Y3 @x=b
YR(2,2) - YL(2,3); % Y2' = Y3' @x=b
YR(1,3)-1]; % Y3(c) = Pl (constant)
end
  1 Kommentar
Anadi Mondal
Anadi Mondal am 6 Sep. 2022
Bearbeitet: Anadi Mondal am 6 Sep. 2022
Thank you @Ameer Hamza . I was badly seraching for the solution technique for this type of problem.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by