How to find a good initial guess for bvp4c? Does it matter to give a good initial guess?
1 view (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Boundary Value Problems in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!