开发者

help with math in R

开发者 https://www.devze.com 2023-02-14 06:19 出处:网络
Need help to plot graphs: Wt contains 1000 Iterators on how far one has walked the 100 steps. Mean and sd are the mean and standard deviation of those 1000. I am asked to create five graphs showing f

Need help to plot graphs:

Wt contains 1000 Iterators on how far one has walked the 100 steps. Mean and sd are the mean and standard deviation of those 1000. I am asked to create five graphs showing from the starting position to the end position after a hundred steps with time t on the x-axis and the status of the y-axis. t is 100.

Can someone explain and show how to plot graph like that?

Code for Wt:

 Wt = NULL
    for(i in 1:1000){
        Xk = rnorm(100,mean=0.4,sd=0.7)
        Wt[i]=su开发者_Go百科m(Xk)
    }

    mean(Wt)
    sd(Wt)


matplot(replicate(5,cumsum(rnorm(100,mean=0.4,sd=0.7))),type="l")
0

精彩评论

暂无评论...
验证码 换一张
取 消