View source: R/brownian.motion.R
brownian.motion | R Documentation |
Brownian motion, or random walk, can be regarded as the trace of some cumulative normal random numbers.
brownian.motion(n = 10, xlim = c(-20, 20), ylim = c(-20, 20), ...)
n |
Number of points in the scatterplot |
xlim, ylim |
Arguments passed to |
... |
other arguments passed to |
The location of the next step is “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.
None (invisible NULL
).
The maximum number of steps in the motion is specified in
ani.options('nmax')
.
Yihui Xie
Examples at https://yihui.org/animation/example/brownian-motion/
rnorm
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.