boundary conditions at infinity

27 次查看(过去 30 天)
Good afternoon one and all. Good afternoon torsten sir
Sir my code is working by taking the boundary conditions as x = linspace(0,1,100) but doesnot working at x = linspace(0,Inf,100);
I request you sir please help me how to write the code for 3 sets of boundary conditions at η ≥0 , η =0 and η→∞.
I attached my equations image and my code error below.
My code :
x = linspace(0,Inf,100);
yinit = [0 1 0 1 0 1 ];
init = bvpinit(x,yinit);
options = bvpset('RelTol',1e-8,'AbsTol',1e-12);
sol = bvp4c(@odefun, @bcfun, init,options);
plot(sol.x, sol.y)
hold on
function dydx = odefun(x,y) % equations being solved
x0=1;x1=1;x2=1;x3=1;x4=1;x5=1;x6=1;s=1;Da=1;Gr=1;Gc=1;prs=1;Ra=1;Qr=1;Sc=1; Kr=1; E=1;n=1;s=1;
us = y(1);
usy = y(2);
theta = y(3);
thetay = y(4);
phi = y(5);
phiy = y(6);
dydx = zeros(6,1);
dydx(1) = usy;
dydx(2) = ((1/x0)*(x1*s*us)+(x0/Da)*us-x2*Gr*theta-x3*Gc*phi-(E/s)*(exp(-s*n)));
dydx(3) = thetay;
dydx(4) = ((1/x5)*(x4*prs*theta)+Ra*theta-Qr*theta);
dydx(5) = phiy;
dydx(6) = (Sc/x6)*(s*phi+Kr*phi);
end
function res = bcfun(yL,yR)
s=1;k=1;
res = zeros(6,1);
res(1) = yL(1)-(1/(2*1i))*(1/(s-1i*k)-1/(s+1i*k));
res(2) = yL(3)-(1/s^2)*(1-exp(-s));
res(3) = yL(5)-(1/s^2)*(1-exp(-s));
res(4)= yR(1);
res(5)= yR(3);
res(6)= yR(5);
end
ERROR:
Error using bvp4c (line 248)
Unable to solve the collocation equations -- a singular Jacobian encountered.
Error in bvpmodel (line 12)
sol = bvp4c(@odefun, @bcfun, init,options);

回答(1 个)

Torsten
Torsten 2024-3-26
编辑:Torsten 2024-3-26
You must use a sufficiently large number instead of "Inf" here:
x = linspace(0,Inf,100)
x = 1x100
0 Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf Inf
  7 个评论
Torsten
Torsten 2024-3-28
I suggest solving equations (8), (9) and (10) directly using "pdepe".
mallela ankamma rao
mallela ankamma rao 2024-3-29,5:21
Thank you sir. i will try in pdepe method

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Elementary Math 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by