I have a coupled second order DE; how to solve them with boundary conditions; How to get get F1 and F2
3 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
Torsten
2017-9-28
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 个评论
Torsten
2017-10-2
编辑:Torsten
2017-10-2
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Boundary Value Problems 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!