1. Brownian Motion in MATLAB

Hey,

I'm supposed to use a box-muller transform to generate two independent realizations of Brownian motions.

I have not had much exposure to Brownian Motion. So, I've got the Box-Muller Transform done and I'm drawing a blank on what to do next in order to "generate two independent realizations of Brownian motions."

Any help is greatly appreciated.

Thanks.

2. Hello,

Here is what we did in Scilab (should be similar to Matlab) for a Brownian motion :

Code:
function X=Brownian(N,T)
X=zeros(N+1,1);
X(1)=0;
for k=2:(N+1)
X(k)=X(k-1)+(T/sqrt(N))*rand(1,1,'norm');
end
endfunction

X=Brownian(200,1);
clf();
plot(X)
Adapt it to get 2 Brownian motion (should not be difficult, since the BM transform actually gives 2 normal random variables ^^)

3. Originally Posted by Moo
Code:
function X=Brownian(N,T)
X=zeros(N+1,1);
X(1)=0;
for k=2:(N+1)
X(k)=X(k-1)+(T/sqrt(N))*rand(1,1,'norm');
end
endfunction

X=Brownian(200,1);
clf();
plot(X)
Just a few tips...
I guess T is the final time; so it should be "sqrt(T)" in the formula. And for this scaling to have some meaning, time should be scaled as well (on the plot).
As a piece of advice: you shouldn't perform the multiplication by sqrt(T/N) at each step: scilab is going to compute N times this square root. And scilab is very matrix oriented (matlab=matrix laboratory, I think) so my program in scilab would be, in one line:
Code:
T=5;N=200;plot((0:N)*T/N,sqrt(T/N)*cumsum([0;rand(N,1,'normal')]));
(cumsum gives the cumulated sum of a vector : [X(1), X(1)+X(2), ...], very convenient)

4. I trust you lol. It has been one year since we wrote this, and we just copied what the teacher wrote