0% found this document useful (0 votes)
279 views2 pages

Blasius Solution by Runge Kutta Method

This document contains code that numerically solves a system of ordinary differential equations (ODEs) using the Runge-Kutta method for different values of a parameter k. It initializes variables, iterates through values of k from 0.1 to 1 in increments of 0.01. At each k value, it numerically solves the system of ODEs from t0 to tN, stores the solution for one of the variables, and plots the results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
279 views2 pages

Blasius Solution by Runge Kutta Method

This document contains code that numerically solves a system of ordinary differential equations (ODEs) using the Runge-Kutta method for different values of a parameter k. It initializes variables, iterates through values of k from 0.1 to 1 in increments of 0.01. At each k value, it numerically solves the system of ODEs from t0 to tN, stores the solution for one of the variables, and plots the results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

clear all

t0=0;
tN=10;
h=0.05;
N=(tN-t0)/h;
F2=zeros(91,201);
for k=0.33
y=[0;0;k];
y1=y(1);
y2=y(2);
y3=y(3);
for n=1:N
A=[0 1 0;0 0 1;(-y(3)/2) 0 0];
k1=A*y;
k2=A*(y+(h/2)*k1);
k3=A*(y+(h/2)*k2);
k4=A*(y+h*k3);
y=y+(h/6)*(k1+2*k2+2*k3+k4);
y1(n+1)=y(1);
y2(n+1)=y(2);
y3(n+1)=y(3);
end
t=[t0:h:tN];
num=int8(100*(k-0.1+0.01));
%F2 has as rows approximations of y2 for the different values of k
F2(num,:)=y2;
end
t=[t0:h:tN];
k1=[0.1:0.01:1];
f10=F2(:,201);
f10=f10';
o=ones(1,91);
bigmatrix=[t.',y1.',y2.',y3.']
figure(1)
hold on
plot(t,y2,'b')
plot(k1,o,'r')
xlabel('\eta')
ylabel('u/U')
legend('f(10)','y=1')
hold off
figure(2)
hold on
plot(t,y1,'b')

plot(t,y2,'r')
plot(t,y3,'g')
xlabel('\eta')
ylabel('Stream Functions')
legend('f1','f2','f3')
hold off

You might also like