How do I solve this bvp4c error ?

조회 수: 1 (최근 30일)
Aryaman Patel
Aryaman Patel 2020년 10월 17일
편집: Aryaman Patel 2020년 10월 18일
So, the error I am getting is : "Unable to solve the collocation equations -- a singular Jacobian encountered" When ever I change "K" value of the global variable to 0, and also the error : Error in Comparison sol = bvp4c(@rhs_bvp, @bc_bvp, init);
The highest order is 2 in the equation :
And the equation is subjected to the boundary value: y = 0 at x = -1 and y = 1 at x = 1
global G m M Da k e1 e2 Uhs beta n gamma
M = 2; m = 0.1; Da = 0.1; Uhs = 1; e1 = 2; e2 = 2; G = 1; k = 0; beta = 0.025;
n = 0; gamma = 0.25;
init = bvpinit (linspace(-1,1),[1 0]);
sol = bvp4c(@rhs_bvp, @bc_bvp, init);
yplot =sol.y(1,:);
xplot =sol.x;
plot(xplot,yplot)
function rhs = rhs_bvp(x,y)
global G m M Da k e1 e2 Uhs gamma n
vel = (((M^2/(1+(m^2))+(1/Da))*y(1)) - G - ((k^2)*Uhs)*((( (e1+e2)/(2*cosh(k))*cosh(k*x) ) - (((e1- e2)/(2*sinh(k)))*sinh(k*x)))))/((1-n)+((sqrt(2))*n*gamma*y(2)));
rhs = [ y(2)
vel
];
end
function bc = bc_bvp(yl,yr)
bc = [yl(1)
yr(1)-1
];
end
Could the error be in the initial value of the problem ?

채택된 답변

Alan Stevens
Alan Stevens 2020년 10월 17일
You have a division by sinh(k)
.../(2*sinh(k)))...
Since k is zero, sinh(k) is zero and the resuting expression for vel is NaN.
  댓글 수: 1
Aryaman Patel
Aryaman Patel 2020년 10월 18일
편집: Aryaman Patel 2020년 10월 18일
Oh I see ! Thanks for pointing it out !

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Analysis에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by