Second order ODE - BVP
Mostra commenti meno recenti
Hi,
I am trying to obtain the solution of the following second order ODE but I struggle.
function bvp5
xlow=0; xhigh=0.5;
solinit = bvpinit(linspace(xlow,xhigh,10),[0 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) 0.64*y(1)-(2/x)*y(2) ];
% -----------------------------------------------
function res = bvp5bc(ya,yb)
res = [ ya(1)-0.2 yb(2) ];
I obtain the folelowing error: Unable to solve the collocation equations -- a
singular Jacobian encountered.
1) How to form a guess ? I dont have any idea ...
2) What is the problem with my equation or my code?
Best wishes,
Risposta accettata
Più risposte (1)
Alan Stevens
il 1 Feb 2021
Modificato: Alan Stevens
il 1 Feb 2021
1 voto
You start at xlow = 0, but your function bvp5ode has an x in the denominator. bvp4c doesn't like it when this is zero! If you set xlow = 0.001, say, then it runs.
1 Commento
sko
il 1 Feb 2021
Categorie
Scopri di più su Boundary Value Problems in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!