Register to reply

Matlab: Plotting multiple paths (random walk)

by spenghali
Tags: matlab, multiple, paths, plotting, random, walk
Share this thread:
spenghali
#1
Jan30-11, 08:11 PM
P: 14
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.

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

plot(t/N,X(1:N+1)/sqrt(N));
axis([0 1 -2 2]);
title(['Uniform Sample 1000 steps'])

ylabel('Position')
xlabel('Time')
Phys.Org News Partner Science news on Phys.org
Climate change increases risk of crop slowdown in next 20 years
Researcher part of team studying ways to better predict intensity of hurricanes
New molecule puts scientists a step closer to understanding hydrogen storage

Register to reply

Related Discussions
Plotting multiple polynomials in matlab Math & Science Software 1
Random walk Advanced Physics Homework 3
Random walk Calculus & Beyond Homework 7
Random walk (3) Calculus & Beyond Homework 0
Random walk (2) Calculus & Beyond Homework 0