Professional Documents
Culture Documents
Codigo Runge Kutta
Codigo Runge Kutta
'Entrada de datos
X0 = Cells(4, 2)
Y0 = Cells(5, 2)
XF = Cells(6, 2)
N = Cells(7, 2)
'Proceso
H = (XF - X0) / N
I = 1
While I <= N
K1 = Fun(X0, Y0)
K2 = Fun(X0 + (H / 2), Y0 + (H * K1 / 2))
K3 = Fun(X0 + (H / 2), Y0 + (H * K2 / 2))
K4 = Fun(X0 + H, Y0 + H * K3)
Y0 = Y0 + H * (K1 + 2 * K2 + 2 * K3 + K4) / 6
X0 = X0 + H
I = I + 1
Wend
Cells(9, 2) = Y0
End Sub