I would like to present a Brownian motion figure (t, W (t)) in dimension 3, so as to have the x and y axes representing the time t and the z axis representing the brownian motion W (t). Here is the code I used in dimension 2 :
tf=350; % Set time interval [0,tf]
N=350; % Set number of steps to compute at in [0,tf]
h=tf/N; % Compute the time step
dW=sqrt(h)*randn(1,N); % Generate array of brownian movements
W=cumsum(dW); % Sum the array cummulativley
t=0:h:tf; % Array of equal time steps
plot(W); % Plot the Wiener process
xlabel('t');ylabel('W(t)');title('Sample Wiener Process')
Best Answer