Error Using "bvp4c" - "a singular Jacobian encountered"
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
MOSLI KARIM
le 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) ];
Réponses (1)
Torsten
le 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 commentaires
Voir également
Catégories
En savoir plus sur Boundary Value Problems dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!