No BSD License  

2.0

2.0 | 1 rating Rate this file 19 Downloads (last 30 days) File Size: 370 Bytes File ID: #18060

Brownian Motion

by

 

18 Dec 2007 (Updated )

Function to simulate Brownian Motion

| Watch this File

File Information
Description

The brownian motion is a function very commonly used in Stochastic Calculus. It is a continous process but not a differentiable function.
The file/function simulate a Brownian Motion Path using the quadratic variation process <W>_t=t
As a word of caution one of the the inputs for the function is t which is not time vector but the upper limit of time till which computation is required ( Eg : t=1sec).
Moreover, to make the function simple and self contained the command "Cumulative-Sum(cumsum)" is not used. This is done to make things clear so that any beginner can also follow the code.

MATLAB release MATLAB 6.5 (R13)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
18 Dec 2007 Jos x@y.z

What I like: it pre-allocates the output.

What I do not like:
1) The help is very poor: if I follow it, the function errors when I enter a time vector (e.g., 1:10) and a number of samples (10). Probably t is to be a scalar also, but that is not clear. It has no H1 line, no useful help on its inputs or outputs, no example.

2) It has no error checks on its inputs, checking for common mistakes (like no scalar inputs).

3) It is poorly programmed, calculating unused variables, etc, setting the rand state without warning, no internal comments

4) it is very trivial, and can be coded in one line: "w = [0 ; cumsum(sqrt(t/n).*rand(n-1,2))]; "

Finaly, try to make clear why anybody wishes to use of this function.

I think this submission is to be rated 1.5 stars ...

Contact us