i need to solve F'''+FF''-​(F')^2-(M^​2)F'=0 with bvp,s are F(0)=3,F'(0)=-1 and F(infinity)=0

1 view (last 30 days)
3rd order ODE. solve in ode45 command
  1 Comment
naveed ibrahim
naveed ibrahim on 14 May 2021
first convert this bvp ti to ivp, by converting it in to system of first order equations. then apply the shooting method to calculate the unknown initial condition(missing condition)..after finding that initial condition you can apply bvp,s.

Sign in to comment.

Answers (3)

Torsten
Torsten on 11 Jan 2018
Use bvp4c.
Best wishes
Torsten.

naveed ibrahim
naveed ibrahim on 14 May 2021
% % equation f'''+ff''-f^2
% % f(0)=0,f'(0)=-1 and f(inf)=0
% % first convert the the above into system of first order ode,s by letting
% % u=f',
% % v=u',then v'=u^2-2fu and crossponding initial conditions for this
% % system of equations are f(0)=0,u(0)=-1 and missing condition is v(0)=s
% % now differinte above initial value system w.r t s and apply NR method
% % to get missing condition s. after finding this missing condition we can
% % apply bvp,s etc
function [x,f,u,v,F,U,V]=shooting(s)
f1=@(x,f,u,v,F,U,V)u;
f2=@(x,f,u,v,F,U,V)v;
f3=@(x,f,u,v,F,U,V)u^2-f*v;
f4=@(x,f,u,v,F,U,V)U;
f5=@(x,f,u,v,F,U,V)V;
f6=@(x,f,u,v,F,U,V)2*u*U-(v*F+f*V);%%U, V and F are obtain by differinating i.v .p with respect to s.
h=0.1;
f(1)=0;
u(1)=-1;
v(1)=s;
F(1)=0;
U(1)=0;
V(1)=1;
x(1)=0;
for i=1:100
k1=h*f1(x(i),f(i),u(i),v(i),F(i),U(i),V(i));%% apply rk method 4
l1=h*f2(x(i),f(i),u(i),v(i),F(i),U(i),V(i));
m1=h*f3(x(i),f(i),u(i),v(i),F(i),U(i),V(i));
n1=h*f4(x(i),f(i),u(i),v(i),F(i),U(i),V(i));
o1=h*f5(x(i),f(i),u(i),v(i),F(i),U(i),V(i));
p1=h*f6(x(i),f(i),u(i),v(i),F(i),U(i),V(i));
k2=h*f1(x(i)+h/2,f(i)+k1/2,u(i)+l1/2,v(i)+m1/2,F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x(i)+h,f(i)+k3,u(i)+l3,v(i)+m3,F(i)+n3,U(i)+o3,V(i)+p3);
n4=h*f4(x(i)+h,f(i)+k3,u(i)+l3,v(i)+m3,F(i)+n3,U(i)+o3,V(i)+p3);
o4=h*f5(x(i)+h,f(i)+k3,u(i)+l3,v(i)+m3,F(i)+n3,U(i)+o3,V(i)+p3);
p4=h*f6(x(i)+h,f(i)+k3,u(i)+l3,v(i)+m3,F(i)+n3,U(i)+o3,V(i)+p3);
f(i+1)=f(i)+(k1+2*k2+2*k3+k4)/6;
u(i+1)=u(i)+(l1+2*l2+2*l3+l4)/6;
v(i+1)=v(i)+(m1+2*m2+2*m3+m4)/6;
F(i+1)=F(i)+(n1+2*n2+2*n3+n4)/6;
U(i+1)=U(i)+(o1+2*o2+2*o3+o4)/6;
V(i+1)=V(i)+(p1+2*p2+2*p3+p4)/6;
x(i+1)=x(i)+h;
end
plot(x,u)

naveed ibrahim
naveed ibrahim on 14 May 2021
here is the shooting with RK and NR method

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!