In [ ]:
using Plots
pyplot(size=(300,300))
# initialize the attractor
n = 3000
dt = 0.02
σ, ρ, β = 10., 28., 8/3
x, y, z = 1., 1., 1.
X, Y, Z = [x], [y], [z]
# initialize a Plots animation
anim = Animation()
# process n steps
for i=1:n
dx = σ*(y - x); x += dt * dx; push!(X,x)
dy = x*(ρ - z) - y; y += dt * dy; push!(Y,y)
dz = x*y - β*z; z += dt * dz; push!(Z,z)
# plot and save to the animation
if mod1(i,10) == 1
frame(anim, plot3d(X,Y,Z))
end
end
# build an animated gif
gif(anim)
In [ ]: