Boundary value problem with 3 regions

3 vues (au cours des 30 derniers jours)
Jagadeesh Korukonda
Jagadeesh Korukonda le 25 Avr 2020
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
  1 commentaire
darova
darova le 25 Avr 2020
Can you show your attemtps?

Connectez-vous pour commenter.

Réponse acceptée

Ameer Hamza
Ameer Hamza le 25 Avr 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 commentaire
Anadi Mondal
Anadi Mondal le 6 Sep 2022
Modifié(e) : Anadi Mondal le 6 Sep 2022
Thank you @Ameer Hamza . I was badly seraching for the solution technique for this type of problem.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Numerical Integration and Differential Equations dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by