刚看了益辉的animation包里的brownian.motion函数和解释
Brownian motion, or random walk, can be regarded as the trace of some cumulative normal random numbers: the location of the next step is just “current location + random Gaussian numbers”, i.e.,
x[k + 1] = x[k] + rnorm(1)
y[k + 1] = y[k] + rnorm(1)
where (x, y) stands for the location of a point.
然后程序里的语句是
n <- 10; #假设产生1个布朗运动,含有10个数据
x = rnorm(n)
y = rnorm(n)
for (i in seq_len(ani.options("nmax"))) { # seq_len(ani.options("nmax"))貌似等于seq(50)
plot(x, y, xlim = xlim, ylim = ylim, ...)
text(x, y)#应该是要对数据标注一下的,试了一下
x = x + rnorm(n)
y = y + rnorm(n)
求仔细的解释