Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Matlab: Plotting multiple paths (random walk)

  1. Jan 30, 2011 #1
    I have created a code to simulate a scaled random walk, but I need to now modify it to generate 1000 paths and then estimate the variance with n = 100, for t = 0.25, 0.5, 0.75 and 1. Can anyone help out with how to generate all 1000 paths? Sorry if this is painfully easy, I am a complete matlab/coding noob.

    N = 10
    t = (0:1:N)';
    X = [0; cumsum(2*(rand(N,1)>0.5)-1)];

    axis([0 1 -2 2]);
    title(['Uniform Sample 1000 steps'])

    Last edited: Jan 30, 2011
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted

Similar Discussions: Matlab: Plotting multiple paths (random walk)
  1. Plotting with MATLAB (Replies: 1)