function X = BM(N) % BM simulates a Brownian Motion on [0,1] Y = zeros(1,N); for i = 2:N Y(i) = Y(i-1) + randn/sqrt(N); end X=Y;