How do I solve this bvp4c error ?

1 次查看(过去 30 天)
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.

更多回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by