I want a whole code for solving the Blasius equation(similarity variable 'eta') using shooting method with Runge Kutta 4th order numerical technique
Afficher commentaires plus anciens
I tried to write a brief code for the Blasius equation but I am unable to proceed further, it will be helpful if improvements are done in the code that I have written
% f'''+1/2*f*f''=0
% converting to 3 1st order odes
% f'=G
% G'=H= f''
% H'= -1/2*f*H = f'''
clc;
close all;
h=0.01; % step size
F1=@(eta,f,G,H) G;
F2=@(eta,f,G,H) H;
F3=@(eta,f,G,H) -1/2*f*H;
%initial conditions
eta(1)=0;
f(1)=0;
G(1)=0;
%initial guess
H(1)= 0.332;
N=10/h; % eta ranges from 0 to 10
for i=1:N
eta(i+1)= eta(i)+h;
k1= F1(f(i), G(i), H(i), eta(i));
l1= F2(f(i), G(i), H(i), eta(i));
m1= F3(f(i), G(i), H(i), eta(i));
k2= F1(f(i)+1/2*h*k1, G(i)+1/2*h*l1, H(i)+1/2*h*m1, eta(i)+h/2);
l2= F2(f(i)+1/2*h*k1, G(i)+1/2*h*l1, H(i)+1/2*h*m1, eta(i)+h/2);
m2= F3(f(i)+1/2*h*k1, G(i)+1/2*h*l1, H(i)+1/2*h*m1, eta(i)+h/2);
k3= F1(f(i)+1/2*h*k2, G(i)+1/2*h*l2, H(i)+1/2*h*m2, eta(i)+h/2);
l3= F2(f(i)+1/2*h*k2, G(i)+1/2*h*l2, H(i)+1/2*h*m2, eta(i)+h/2);
m3= F3(f(i)+1/2*h*k2, G(i)+1/2*h*l2, H(i)+1/2*h*m2, eta(i)+h/2);
k4= F1(f(i)+h*k3, G(i)+h*l3, H(i)+h*m3, eta(i)+h);
l4= F2(f(i)+h*k3, G(i)+h*l3, H(i)+h*m3, eta(i)+h);
m4= F3(f(i)+h*k3, G(i)+h*l3, H(i)+h*m3, eta(i)+h);
f(i+1)= f(i)+ h/6*(k1+2*(k2+k3)+k4);
G(i+1)= G(i)+ h/6*(l1+2*(l2+l3)+l4);
H(i+1)= H(i)+ h/6*(m1+2*(m2+m3)+m4);
end
plot(eta,f,'r')
hold on
plot(eta,G,'b')
hold on
plot(eta,H,'g')
3 commentaires
Nainaru Tarakaramu
le 19 Juin 2018
i want code for three dimensional graph plotting using shooting technique with Runge-kutta method
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Numerical Integration and Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!