Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Del alumno
Al profesor
Angel Sangiacomo
Asunto
Fecha
09-09-2015
Entonces el mtodo RK4 para este problema est dado por la siguiente
ecuacin:
Donde
es del orden de
, razn por la cual es usado en los mtodos
computacionales, mientras sean mononcleo ya que es un mtodo que es muy
costoso al paralelizarlo, por lo que se prefieren otros.
Qu hace?
Obtiene una aproximacin al problema de valor inicial bien planteado.
at b
y
=f ( t , y )
t
y 0=a
k 1=hf ( t i , y i )
1
1
k 2=hf t i + h , y i + k
2
2 1
1
1
k 3 =hf t i + h , yi + k
2
2 2
(
(
k 4=hf ( t i +h , y i+ k 3 )
k
2( 2+k 3 )+k 4
k 1 +
1
y i+1= y i +
6
Variables:
fu: Funcin f(t,y) en formato texto debe contener variables t y y
vi: Valor de Valor Inicial
a: Valor de a
b: Valor de b
n: Numero de iteraciones
h: Tamao de paso
ti: Valor Inicial de la variable t
k1: contiene la primera parte
k2: contiene la segunda parte
k3: contiene la tercera parte
k4: contiene la cuarta parte
yii: Valores de la variable y obtenido por el mtodo de Runge Kutta 04
Algoritmo
function f=f(z,t,y)
f=eval(z);
z : funcin en formato texto debe contener variables t y y
mrungekutta04.m
clc;
disp(' METODO DE RUNGE KUTTA 04 ');
fu=input('ingrese funcion f(t,y) = ');
vi=input('ingrese Valor de Valor Inicial = ');
a=input('ingrese Valor de A = ');
b=input('ingrese Valor de B = ');
n=input('ingrese iteraciones = ');
h=(b-a)/n;
disp('h=');
disp(h);
ti=a;
yii=vi;
%--------------------hold off;
xlabel('Pasos')
ylabel('Valor aproximado')
%--------------------plot(ti,yii,'+');
disp(' ti
y(ti)
');
for i=1:n+1
fprintf ('\n%5.5f
%5.5f
',ti,yii);
k1=h*f(fu,ti,yii);
k2=h*f(fu,ti+h/2,yii+k1/2);
k3=h*f(fu,ti+h/2,yii+k2/2);
k4=h*f(fu,ti+h,yii+k3);
yii=yii+1/6*(k1+2*(k2+k3)+k4);
ti=ti+h;
%--------------------hold on;
plot(ti,yii,'+');
%--------------------end
%--------------------hold on;
legend('Metodo de Runge Kutta 04');
%--------------------disp('');
0.00000
0.00517
0.02140
0.04986
0.09182
0.14872
0.22212
0.31375
0.42554
0.55960
0.71828