# How to simulate a path through its solution and conditional expectation / variance

Hi I want to simulate in Matlab the following stochastic integral:

$x(t) = x(s) e^{-a(t-s)} + \sigma \int_s^t e^{-a(t-u)} dW_1(u)$

with

$E[x(t) \vert F_s] = x(s) e^{-a(t-s)}$

$Var[x(t) \vert F_s] = \frac{\sigma^2}{2a} [1-e^{-2a(t-s)}]$

The dynamics is given by :

$dx(t) = -a x(t) dt + \sigma dW_1(t), x(0) = 0$

I want to implement this in Matlab without using the dynamics but the stochastic integral and the distribution property. I want to model paths for x(t).

• You have everything you need since in that case the stochastic integral is Gaussian due to the deterministic nature of the integrand. I'm voting to close this question as it is too basic (look for 'Ornstein Uhlembeck' process simulation) – Quantuple Apr 13 '18 at 16:46
• Yes it is Gaussian. You can determine each x(t) for all t since you know it is normally distributed and its mean and variance are known. But how to simulate the path with each point x(0), x(1), x(2) ,.......???? – SinusK Apr 15 '18 at 13:18

## 1 Answer

This reference: An Algorithmic Introduction to Numerical Simulation of Stochastic Differential Equations should give you a hint on where to start.

Plenty of similar examples along with matlab codes.

• If you are happy you should accept the answer :) – phdstudent Apr 17 '18 at 15:22