Error Using "bvp4c" - "a singular Jacobian encountered"
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentario
MOSLI KARIM
el 7 de Nov. de 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) ];
Respuestas (1)
Torsten
el 9 de Nov. de 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 comentarios
Ver también
Categorías
Más información sobre Boundary Value Problems en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!