# How to create Brownian Motion Model and GBM in Matlab

(Last Updated On: August 2, 2010)

Here are some popular ways to create BMs within Matlab. From the help system:

Creating Brownian Motion (BM) Models

The Brownian Motion (BM) model derives directly from the linear drift (SDELD) class:

Example: BM Models. Create a univariate Brownian motion (BM) object to represent the model:

obj = bm(0, 0.3) % (A = Mu, Sigma)
obj =
Class BM: Brownian Motion
—————————————-
Dimensions: State = 1, Brownian = 1
—————————————-
StartTime: 0
StartState: 0
Correlation: 1
Drift: drift rate function F(t,X(t))
Diffusion: diffusion rate function G(t,X(t))
Simulation: simulation method/function simByEuler
Mu: 0
Sigma: 0.3

BM objects display the parameter A as the more familiar Mu.

The BM class also provides an overloaded Euler simulation method that improves run time performance in certain common situations. This specialized method is invoked automatically only if all of the following conditions are met:

*

The expected drift, or trend, rate Mu is a column vector.
*

The volatility rate, Sigma, is a matrix.
*

*

If specified, the random noise process Z is a three-dimensional array.
*

If Z is unspecified, the assumed Gaussian correlation structure is a double matrix.

Creating Geometric Brownian Motion (GBM) Models

The Geometric Brownian Motion (GBM) model derives directly from the CEV model:

Compared to CEV, GBM constrains all elements of the alpha exponent vector to one such that D is now a diagonal matrix with the state vector X along the main diagonal.

The GBM class also provides two simulation methods that can be used by separable models:

*

An overloaded Euler simulation method that improves run time performance in certain common situations. This specialized method is invoked automatically only if all of the following conditions are true:
o

The expected rate of return (Return) is a diagonal matrix.
o

The volatility rate (Sigma) is a matrix.
o

o

If specified, the random noise process Z is a three-dimensional array.
o

If Z is unspecified, the assumed Gaussian correlation structure is a double matrix.

*

An approximate analytic solution (simBySolution) obtained by applying an Euler approach to the transformed (using Ito’s formula) logarithmic process. In general, this is not the exact solution to this GBM model, as the probability distributions of the simulated and true state vectors are identical only for piecewise constant parameters. If the model parameters are piecewise constant over each observation period, the state vector Xt is log-normally distributed and the simulated process is exact for the observation times at which Xt is sampled.

Example: Univariate GBM Models. Create a univariate GBM object to represent the model:

obj = gbm(0.25, 0.3) % (B = Return, Sigma)
obj =
Class GBM: Generalized Geometric Brownian Motion
————————————————
Dimensions: State = 1, Brownian = 1
————————————————
StartTime: 0
StartState: 1
Correlation: 1
Drift: drift rate function F(t,X(t))
Diffusion: diffusion rate function G(t,X(t))
Simulation: simulation method/function simByEuler
Return: 0.25
Sigma: 0.3

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!
This entry was posted in Quant Analytics and tagged , , , on by .