3rd order non linear differential equation

2f'''+f.f''=0
The boundary conditions are given as
f(0)=r, f'(0)=0, f'(∞)=1 , where r is a constant .
How can I solve this differential equation using Matlab or Mathematica ??

 Accepted Answer

Set
y1=f, y2=f',y3=f'',
rewrite your system as
y1'=y2
y2'=y3
y3'=-0.5*y1*y3,
set oo to a sufficiently large value and use MATLAB's bvp4c to solve.
Best wishes
Torsten.

11 Comments

Hey thanks a lot for giving me the initial thrust. I happen to be a mechanical engineer with near zero knowledge of MATLAB. This is what I have been able to come up with.. your inputs will be highly appreciated.
if true
function dydx = ode(x,y)
dydx = [ y(2)
y(3)
-0.5*y(1)*y(3)];
function res = obc(ya,yb)
res = [ ya(1)-1
ya(2)
yb(2)];
solinit = bvpinit()
SOL = bvp4c(ode,obc,SOLINIT)
Can you help me out with bvpint function?
function dydx = ode(x,y)
dydx = [ y(2)
y(3)
-0.5*y(1)*y(3)];
function res = obc(ya,yb)
r=0.1;
res = [ ya(1)-r
ya(2)
yb(2)-1.0];
xend=10;
SOLINIT = bvpinit(linspace(0,xend),[0.1 1 0]);
SOL = bvp4c(@ode,@obc,SOLINIT)
Best wishes
Torsten.
Thank you sir for your time and knowledge in helping me out, but I have been facing the following warning message.
function dydx = ode(x,y) | Error: Function definitions are not permitted in this context.
Do I need to write the code in separate windows ?
Try out whether this code runs:
function matbvp4c
xend=10;
SOLINIT = bvpinit(linspace(0,xend),[0.1 1 0]);
SOL = bvp4c(@ode,@obc,SOLINIT);
function dydx = ode(x,y)
dydx = [ y(2)
y(3)
-0.5*y(1)*y(3)];
function res = obc(ya,yb)
r=0.1;
res = [ ya(1)-r
ya(2)
yb(2)-1.0];
Best wishes
Torsten.
Thank you very much Sir for helping me out with this problem. The code did run and gave the values of f wrt x. Sir, what are the modifications I need to do to get the value of f' and f'' for this problem .
function matbvp4c
xend=10;
SOLINIT = bvpinit(linspace(0,xend),[0.1 1 0]);
SOL = bvp4c(@ode,@obc,SOLINIT);
y=deval(SOL,SOL.x);
plot(SOL.x,y(1,:),SOL.x,y(2,:),SOL.x,y(3,:));
function dydx = ode(x,y)
dydx = [ y(2)
y(3)
-0.5*y(1)*y(3)];
function res = obc(ya,yb)
r=0.1;
res = [ ya(1)-r
ya(2)
yb(2)-1.0];
y(1,:) is f, y(2,:) is f' and y(3,:) is f''.
Best wishes
Torsten.
Thank you a lot sir. Can the matbvp4c function be used to solve a 2nd order DE. Like I have this equation.
2y''+a.b.y'=0 .
y(0)=1
y(∞)=0
a and b can be assumed as constants with values 0.1 and 0.2 respectively .
Thank you.
Solution is y(x)=exp(-a*b*x/2).
Best wishes
Torsten.
thank you sir for the answer, but I am required to write a code for the same in Matlab and I am not getting the correct results. So I will be really obliged if you can help me out with the code.
Thank you.
Please show what you have done so far. Maybe we can find the error together.
Best wishes
Torsten.
i know how to solve it by inbuilt methods but i want the coding of RK-4 step by step to solve this balsius equation. if somebody could help i will be grateful

Sign in to comment.

More Answers (0)

Categories

Find more on Programming 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!