Error Using "bvp4c" - "a singular Jacobian encountered"
조회 수: 4 (최근 30일)
이전 댓글 표시
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
MOSLI KARIM
2023년 11월 7일
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) ];
답변 (1개)
Torsten
2015년 11월 9일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Boundary Value Problems에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!