Solve a second order BVP with a singularity problem
조회 수: 1 (최근 30일)
이전 댓글 표시
I am trying to use BVP4C to solve a second order nonlinear BVP. My code below includes the initial guess, boundary conditions etc. I think there is something wrong with the division by y(1) in the bvpfcn part, as without it there seems to be no problem running it. Could someone suggest a way to get round this? Even if I try the interval to be (-100,-1) there still seems to be a problem with not being able to meet the tolerance. Many thanks in advance!
xmesh = linspace(-100,0,500);
solinit = bvpinit(xmesh, @guess);
sol = bvp4c(@bvpfcn, @bcfcn, solinit);
plot(sol.x,sol.y(1,:),'k')
function dydx = bvpfcn(~,y) %The BVP problem
%dydx = zeros(2,1);
dydx = [y(2)
(y(1)-1) - y(2)*(15+y(2))/y(1)]; %I think the problem is the division by y(1) here
end
function res = bcfcn(ya,yb) %Boundary conditions
res = [ya(2)
yb(1)];
end
function g = guess(x) %Initial guess
g = [sin(x)
cos(x)];
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!