这是Plots里面给出的例子,我按源码执行出错,不知道哪里有问题
n = 1500
dt = 0.02
σ, ρ, β = 10., 28., 8/3
x, y, z = 1., 1., 1.
using Plots
# initialize a 3D plot with 1 empty series
plt = path3d(1, xlim=(-25,25), ylim=(-25,25), zlim=(0,50),
xlab = "x", ylab = "y", zlab = "z",
title = "Lorenz Attractor", marker = 1)
# build an animated gif, saving every 10th frame
@gif for i=1:n
dx = σ*(y - x) ; x += dt * dx
dy = x*(ρ - z) - y ; y += dt * dy
dz = x*y - β*z ; z += dt * dz
push!(plt, x, y, z)
end every 10
ERROR: LoadError: UndefVarError: y not defined
Stacktrace:
[1] macro expansion at /home/rzhli/Documents/Julia/example:13 [inlined]
[2] top-level scope at /home/rzhli/.julia/packages/Plots/rmogG/src/animation.jl:155 [inlined]
[3] top-level scope at ./none:0
in expression starting at /home/rzhli/Documents/Julia/example:12