How to find a good initial guess for bvp4c? Does it matter to give a good initial guess?
1 次查看(过去 30 天)
显示 更早的评论
My solution to the bvp4c seems to depend on the initial guess. How to choose a good initial guess? Also, my solution varies with the number of points I choose to initialise my bvp, i.e. Nzeta in solinit = bvpinit(linspace(0,zinf,Nzeta),[0;0.1;0;0]). A snippet of my code is given below.
zinf = 300; Nzeta = 501;
solinit = bvpinit(linspace(0,zinf,Nzeta),[0;0.1;0;0]);
sol = bvp4c(@bvpfn, @bvp_bc, solinit);
x = linspace(0,zinf,Nzeta);
y = deval(sol,x);
function dydx = bvpfn(x,y)
global k2 k3 k4 rho Dc Dh M O H
dydx(1) = y(2);
dydx(2) = (2*k2*H/rho^2*Dc) * y(1)^2;
dydx(3) = y(4);
dydx(4) = 1/(rho^2*Dh) * (-5*k2*H*y(1)^2 + 3*k3*M*y(3)^2 - 2*k4*y(3)^2);
end
function res = bvp_bc(ya,yb)
res = [ya(1);
yb(1);
ya(3);
yb(4)];
end
0 个评论
回答(0 个)
另请参阅
类别
在 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!