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 日

0 投票

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 件)

カテゴリ

タグ

質問済み:

2020 年 10 月 17 日

編集済み:

2020 年 10 月 18 日

Community Treasure Hunt

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

Start Hunting!

Translated by