mirror of
https://github.com/ArthurDanjou/ArtStudies.git
synced 2026-01-14 18:59:59 +01:00
12 lines
307 B
Plaintext
12 lines
307 B
Plaintext
# Exercise 5 : Simulation of Brownian Motion
|
|
|
|
```{r}
|
|
n <- 1:1100
|
|
brownian <- function (i) {
|
|
return ((i >= 1 & i <= 100)*(i/100) + (i >= 101 & i <= 110)*(1 + (i - 100)/10) + (i >= 111 & i <= 1110)*(2 + (i - 110)/1000))
|
|
}
|
|
t <- brownian(n)
|
|
W0 <- 0
|
|
Wt <- W0 + sqrt(t) * rnorm(1100)
|
|
plot(t, Wt, type = "o")
|
|
``` |