Function File: [Paths, Times, Z] = simulate (SDE, …)

Simulates a stochastic differential equation (SDE).

  • Variable: SDE An sde object.

This method passes any additional arguments to the simulation routine specified by the sde object.

The outputs are described below:

  • Variable: Paths (NPERIODS + 1)-by-NVARS-by-NTRIALS array consisting of the simulated paths.
  • Variable: Times (NPERIODS + 1)-dimensional column vector of observation corresponding to the paths.
  • Variable: Z (NPERIODS * NSTEPS)-by-NBROWNS-by-NTRIALS array of variates used to generate the process.

Below is an example simulating a two-dimensional process driven by two correlated Wiener processes:

Asset1Price  = 100.; Asset2Price  = 90.  ;
Volatility1  = 0.2 ; Volatility2  = 0.3  ;
Dividends1   = 0.  ; Dividends2   = 0.005;
RiskFreeRate = 0.04;
Correlation  = 0.5;
ExpiryTime   = 1.;

Drift     = drift ([0;0], [RiskFreeRate-Dividends1 0;0 RiskFreeRate-Dividends2]);
Diffusion = diffusion ([1;1], [Volatility1 0;0 Volatility2]);

M = 1000; # Number of simulations
N = 10;   # Number of timesteps

SDE = sde (Drift, Diffusion, "StartState", [Asset1Price;Asset2Price], ...
           "Correlation", [1 Correlation;Correlation 1]);
[Paths, ~, ~] = simulate (SDE, 1, "DeltaTime", ExpiryTime, ...
                          "NTRIALS", M, "NSTEPS", N);

See also: @sde/simByEuler.

Package: financial