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!