singular Jacobian encountered bvp4c
1 view (last 30 days)
Show older comments
I'm following the bvp4c example 5 found here:
I have tried to modify the code for my problem, however I receive 'a singular Jacobian encountered' message when I try to run my code.
This is what I have:
function nNbvp
etainf = 55;
options = bvpset('RelTol',1e-6);
solinit = bvpinit(linspace(0,etainf),[0 0.506869 1 -0.624297 0]);
sol = bvp4c(@nN,@nNbc,solinit,options);
eta = sol.x;
f = sol.y;
fprintf('\n');
fprintf('Value of H(etainf) is = %7.5f.\n',f(5,end))
clf reset
hold on
plot(eta,f(1,:));
plot(eta,f(3,:));
plot(eta,f(5,:));
axis([0 55 0 2]);
xlabel('\eta')
hold off
shg
% --------------------------------------------------------------------------
function Yprime = nN(eta,Y)
n = 0.9;
X(1) = (Y(2)^2+Y(4)^2)^((1-n)/2);
X(2) = Y(5)+((1-n)/(n+1))*eta*Y(1);
X(3) = (n-1)/(Y(2)^(2)+Y(4)^(2));
X(4) = Y(2)*Y(4)*X(3);
Yprime = [ Y(1)
X(1)/n*((Y(1)^2-Y(3)^2+X(2)*Y(2))*(1+X(3)*Y(4)^2)-X(4)*(2*Y(1)*Y(3)+X(2)*Y(4)))
Y(3)
X(1)/n*((2*Y(1)*Y(3)+X(2)*Y(4))*(1+X(3)*Y(2)^2)-X(4)*(Y(1)^2-Y(3)^2+X(2)*Y(2)))
-2*Y(1)-((1-n)/(n+1))*eta*Y(2)];
% --------------------------------------------------------------------------
function res = nNbc(Y0,Yinf)
n = 0.9;
res = [Y0(1)
Y0(3)-1
Y0(5)
Yinf(2) - (n/(inf*(n-1)))*Yinf(1)
Yinf(4) - (n/(inf*(n-1)))*Yinf(3)];
Can anybody help explain why I am receiving this message? I'm sure the problem is set up correctly, I have checkedit through numerous times.
Thanks.
Answers (0)
See Also
Categories
Find more on Boundary Value Problems in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!