# ORNSTEIN_UHLENBECK Approximate Solution of a Stochastic Differential Equation

ORNSTEIN_UHLENBECK is a MATLAB library which approximates solutions of the Ornstein-Uhlenbeck stochastic differential equation (SDE) using the Euler method and the Euler-Maruyama method.

The Ornstein-Uhlenbeck stochastic differential equation has the form:

```        dx(t) = theta * ( mu - x(t) ) dt + sigma dW,
x(0) = x0.
```
where
• theta is a nonnegative decay rate;
• mu is a mean value for x;
• sigma measures the strength of the stochastic perturbation.
and the equation is to be integrated over the interval [0,tmax].

The starting value x0 represents a deviation from the mean value mu. The decay rate theta determines how fast x(t) will move back towards its mean value. The coefficient sigma determines the relative magnitude of stochastic perturbations.

In general, the solution starts at x0 and over time moves towards the value mu, but experiences random "wobbles" whose size is determined by sigma. Increasing theta makes the solution move towards the mean faster.

### Licensing:

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

### Languages:

ORNSTEIN_UHLENBECK is available in a C version and a C++ version and a FORTRAN77 version and a FORTRAN90 version and a MATLAB version.

### Related Data and Programs:

BLACK_SCHOLES, a MATLAB library which implements some simple approaches to the Black-Scholes option valuation theory, by Desmond Higham.

BROWNIAN_MOTION_SIMULATION, a MATLAB program which simulates Brownian motion in an M-dimensional region.

CNOISE, a MATLAB library which generates samples of noise obeying a 1/f^alpha power law, by Miroslav Stoyanov.

COLORED_NOISE, a MATLAB library which generates samples of noise obeying a 1/f^alpha power law.

CORRELATION, a MATLAB library which contains examples of statistical correlation functions.

PCE_BURGERS, a MATLAB program which defines and solves a version of the time-dependent viscous Burgers equation, with uncertain viscosity, using a polynomial chaos expansion in terms of Hermite polynomials, by Gianluca Iaccarino.

PCE_LEGENDRE, a MATLAB program which assembles the system matrix associated with a polynomal chaos expansion of a 2D stochastic PDE, using Legendre polynomials;

PCE_ODE_HERMITE, a MATLAB program which sets up a simple scalar ODE for exponential decay with an uncertain decay rate, using a polynomial chaos expansion in terms of Hermite polynomials.

PINK_NOISE, a MATLAB library which computes a "pink noise" signal obeying a 1/f power law.

SDE, a MATLAB library which illustrates the properties of stochastic differential equations (SDE's), and common algorithms for their analysis, including the Euler method, the Euler-Maruyama method, and the Milstein method, by Desmond Higham;

STOCHASTIC_DIFFUSION, MATLAB functions which implement several versions of a stochastic diffusivity coefficient.

STOCHASTIC_GRADIENT_ND_NOISE, a MATLAB program which solves an optimization problem involving a functional over a system with stochastic noise.

STOCHASTIC_RK, a MATLAB library which applies a Runge Kutta (RK) scheme to a stochastic differential equation.

### Reference:

1. Desmond Higham,
An Algorithmic Introduction to Numerical Simulation of Stochastic Differential Equations,
SIAM Review,
Volume 43, Number 3, September 2001, pages 525-546.

### Source Code:

• ou_euler.m, uses the Euler method to approximate a solution to the Ornstein-Uhlenbeck equation.
• ou_euler_maruyama.m, uses the Euler-Maruyama method to approximate a solution to the Ornstein-Uhlenbeck equation.
• timestamp.m, prints the YMDHMS date as a timestamp.

### Examples and Tests:

A number of graphics images are created by the example programs:

You can go up one level to the MATLAB source codes.

Last revised on 21 January 2013.