Error Using "bvp4c" - "a singular Jacobian encountered"
2 views (last 30 days)
Show older comments
Hi,
I'm trying to run the following code, but keep running into an error:
function bvp5
xlow=0; xhigh=1;
solinit = bvpinit(linspace(xlow,xhigh,100),[1 -1]);
sol = bvp4c(@bvp5ode,@bvp5bc,solinit);
xint = linspace(xlow,xhigh);
Sxint = deval(sol,xint);
plot(xint,Sxint(1,:))
function dydx = bvp5ode(x,y)
dydx = [ y(2) (-1-y(2)/x)];
function res = bvp5bc(ya,yb)
res = [ ya(1)-1 yb(2) ];
And I get an error involving "a single Jacobian encountered". It seems to plot fine if I use:
function dydx = bvp5ode(x,y)
dydx = [ y(2) (-1-y(2))];
I attached the differential equation I'm trying to solve as a picture, where "T" is y and "r" is x in the code above.
Thanks
1 Comment
MOSLI KARIM
on 7 Nov 2023
function bvp5
xlow=0.00001; xhigh=1;
solinit = bvpinit(linspace(xlow,xhigh,100),[1 -1]);
sol = bvp4c(@bvp5ode,@bvp5bc,solinit);
xint = linspace(xlow,xhigh);
Sxint = deval(sol,xint);
plot(xint,Sxint(1,:))
function dydx = bvp5ode(x,y)
dydx = [ y(2) (-1-y(2)/x)];
function res = bvp5bc(ya,yb)
res = [ ya(1)-1 yb(2) ];
Answers (1)
Torsten
on 9 Nov 2015
The general solution of your equation is
y(x)=c1*log(x)+c2-x^2/4
with c1, c2 to be determined from the boundary conditions.
Now you can easily see that for the boundary conditions you want to prescribe, your equation does not have a solution.
Best wishes
Torsten.
0 Comments
See Also
Categories
Find more on Boundary Value Problems in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!