In [1]:
using RK4
In [8]:
function my_ode!(t, x, xdot, params=nothing)
for kk=2:length(x)
# some crazy ass ODE
xdot[kk] = -cos(sum(abs(x))) * x[kk-1]
end
xdot[1] = -cos(sum(abs(x))) * x[end] + sin(t)
end
x0 = zeros(5)
tlist = linspace(0, 100., 1001)
xts = rk4solve(my_ode!, x0, tlist, .01)
Out[8]:
In [9]:
using PyPlot
plot(tlist, xts')
Out[9]: