フィルターのクリア

Error using bvp4c (singular jacobian encountered)

1 回表示 (過去 30 日間)
Day Rosli
Day Rosli 2016 年 1 月 17 日
回答済み: Torsten 2016 年 1 月 18 日
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.

回答 (1 件)

Torsten
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.

カテゴリ

Help Center および File ExchangeBoundary Value Problems についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by