Error using bvp4c (singular jacobian encountered)
Afficher commentaires plus anciens
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.
Réponses (1)
Torsten
le 18 Jan 2016
0 votes
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.
Catégories
En savoir plus sur Boundary Value Problems dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!