I'm trying to add_trace ad each loop, but I get only one plot with multiplies lines on over each other.
mean <- -0.0007200342
sd <- 0.3403711
N=10
T=1
Delta = T/N
W = c(0,cumsum( sqrt(Delta) * rnorm(N, mean=mean, sd=sd)))
t <- seq(0,T, length=N+1)
p<-plot_ly(y=W, x=t)
for(i in 1:5){
W <- c(0,cumsum( sqrt(Delta) * rnorm(N, mean=mean, sd=sd)))
p<-add_trace(p, y=W)
}
print(p)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…