How to solve following BVP ODE?
Show older comments
Hi mates,
I am trying to solve the following ODE in MATLAB, but I do not attain a reasonable answer. It would be highly appreciated if you let me know of the bugs in my code below the ODE.
The ODE is: (d/dx)(y^3 dy/dx)+(2/3)(x dy/dx)-(1/3)y=0;
The BC's are: (y^3)(dy/dx)=-1, for x=0; and y(inf)=0;
What I have done is to use transforms as below
Y(1)=y;
Y(2)=dy/dx;
Then, dY(1)/dx=Y(2) and dY(2)/dx=((1/3)(1/Y(1)^2))-((2/3)(xY(2)/Y(1)^3)) (to have this equation I just ignored the high order small value of (dy/dx)^2 which is an assumption I took; If there is better solution I would be happy to replace).
According to above descriptions, I used following code in MATLAB:
function liftoff()
xmesh=linspace(0,4,10);
solinit = bvpinit(xmesh,[1 0]);
sol = bvp4c(@lode,@bcs,solinit);
plot(sol.x,sol.y(1,:),'b-x');
function dYdx = lode(x,Y)
dYdx(1) = Y(2);
dYdx(2) = (1/3)*((1/(Y(1)^2))-(2*x*Y(2)/(Y(1)^3)));
function res = bcs(ya,yb)
res = [ ((ya(1)^3)*ya(2))+1;
yb(1)];
But, I encountered with error of "a singular Jacobian".
I am looking forward to hearing your advices.
Cheers,
Dariush
Accepted Answer
More Answers (0)
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!