Error using bvp4c (singular jacobian encountered)
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi, I got error while running this problem of bvp. What does this mean and how to solve this?
Error:
Error using bvp4c (line 251)
Unable to solve the collocation equations -- a singular Jacobian encountered
Here is the code:
function ex111bvp
n=1;
solinit = bvpinit(linspace(0,20,2),[0 0 0 0 -1]);
options = bvpset('Stats','on','RelTol',1e-5);
sol = bvp4c(@ex111ode,@ex111bc,solinit,options);
% The solution at the mesh points
x = sol.x;
y = sol.y;
figure
plot(x,y')
title('Example 111')
ylabel('sol')
xlabel('eta')
% --------------------------------------------------------------------------
function dydx = ex111ode(x,y,n)
n=1;
dydx = [ -2*y(3)-x*(1-n/(n+1))*y(4)
y(3)
y(2)^2-(y(4)+1)^2+(y(1)+(1-n/(n+1))*x*y(2))*y(3)-y(3)*(n-1)*(y(3)^2+y(5)^2)^((n-3)/2)*y(5)*(((y(3)^2+y(5)^2)^((n-1)/2)+y(3)^2*(y(3)^2+y(5)^2)^((n-3)/2)*(n-1))*((y(3)^2+y(5)^2)^((n-1)/2)+y(5)^2*(y(3)^2+y(5)^2)^((n-3)/2)*(n-1))-((y(3)^2+y(5)^2)^((n-1)/2)+y(5)^2*(y(3)^2+y(5)^2)^((n-3)/2)*(n-1))*(y(3)*(y(1)-x*y(2)*(1-n/(n+1)))-(y(4)+1)^2+y(2))+((y(3)^2+y(5)^2)^(3-n)*(y(3)^2+y(5)^2)^((n-3)/2)*(y(5)*(y(1)-x*y(2)*(1-n/(n+1)))-2*y(2)*(y(4)+1)))/(y(3)*y(5)*(n-1)))/(((y(3)^2+y(5)^2)^((n-1)/2)+y(3)*(n-1)*(y(3)^2+y(5)^2)^((n-3)/2)))
y(5)
-2*y(2)*(y(4)+1)+(y(1)-x*(1-n/(n+1))*y(2))*y(5)-y(5)*(n-1)*(y(3)^2+y(5)^2)^((n-3)/2)*y(3)*(y(3)*y(5)*(y(3)^2+y(5)^2)^((n-3)/2)*(n-1)*(y(3)*(y(1)-x*y(2)*(1-n/(n+1)))-(y(4)+1)^2+y(2))-((y(3)^2+y(5)^2)^((n-1)/2)+y(3)^2*(y(3)^2+y(5)^2)^((n-3)/2)*(n-1))*((y(3)^2+y(5)^2)^((n-1)/2)+y(5)*(y(3)^2+y(5)^2)^((n-1)/2)+y(5)*(y(3)^2+y(5)^2)^((n-3)/2)*(n-1))-((y(3)^2+y(5)^2)^(3-n)*(y(5)*(y(1)*x*y(2)*(1-n/(n+1)))-2*y(2)*(y(4)+1))*((y(3)^2+y(5)^2)^((n-1)/2)+y(3)*(y(3)^2+y(5)^2)^((n-3)/2)*(n-1)))/(y(3)^2*y(5)^2*(n-1)^2))/(((y(3)^2+y(5)^2)^((n-1)/2)+y(5)*(n-1)*(y(3)^2+y(5)^2)^((n-3)/2))) ];
%-------------------------------------------------------------------------
function res = ex111bc(ya,yb)
res = [ ya(1)
ya(2)
ya(4)
yb(2)
yb(4)+1];
%-------------------------------------------------------------------------
Thank you in advance.
댓글 수: 0
답변 (1개)
Torsten
2016년 1월 18일
Use
sol = bvp4c(@(x,y)ex111ode(x,y,n),@ex111bc,solinit,options);
as call to bvp4c.
If the problem persists, look whether dydx contains Inf or NaN values.
Best wishes
Torsten.
댓글 수: 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!