Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Because base-level SDE objects accept drift and diffusion objects
in lieu of functions accessible by (* t*,

`SDE`

objects with combinations of
customized drift or diffusion functions and objects. The `drift`

and`diffusion`

rate classes encapsulate the details of
input parameters to optimize run-time efficiency for any given combination
of input parameters.Although `drift`

and `diffusion`

objects
differ in the details of their representation, they are identical
in their basic implementation and interface. They look, feel like,
and are evaluated as functions:

The

`drift`

class allows you to create drift-rate objects of the form:$$F(t,{X}_{t})=A(t)+B(t){X}_{t}$$

where:

`A`

is an`NVARS`

-by-`1`

vector-valued function accessible using the (,*t*) interface.*X*_{t}`B`

is an`NVARS`

-by-`NVARS`

matrix-valued function accessible using the (,*t*) interface.*X*_{t}

Similarly, the

`diffusion`

class allows you to create diffusion-rate objects:$$G(t,{X}_{t})=D(t,{X}_{t}^{\alpha (t)})V(t)$$

where:

`D`

is an`NVARS`

-by-`NVARS`

diagonal matrix-valued function.Each diagonal element of

`D`

is the corresponding element of the state vector raised to the corresponding element of an exponent`Alpha`

, which is an`NVARS`

-by-`1`

vector-valued function.`V`

is an`NVARS`

-by-`NBROWNS`

matrix-valued volatility rate function`Sigma`

.`Alpha`

and`Sigma`

are also accessible using the (,*t*) interface.*X*_{t}

In this example, you create `drift`

and `diffusion`

rate
objects using the `drift`

and `diffusion`

constructors
to create the same model as in Example: Base SDE Models.

Create a drift-rate function `F`

and a diffusion-rate
function `G`

:

`F = drift(0, 0.1) % Drift rate function F(t,X)`

F = Class DRIFT: Drift Rate Specification ------------------------------------- Rate: drift rate function F(t,X(t)) A: 0 B: 0.1

`G = diffusion(1, 0.3) % Diffusion rate function G(t,X)`

G = Class DIFFUSION: Diffusion Rate Specification --------------------------------------------- Rate: diffusion rate function G(t,X(t)) Alpha: 1 Sigma: 0.3

Each object displays like a MATLAB structure and contains
supplemental information, namely, the object's class and a brief description.
However, in contrast to the SDE representation, a summary of the dimensionality
of the model does not appear, because `drift`

and `diffusion`

classes create model components rather
than models. Neither `F`

nor `G`

contains
enough information to characterize the dimensionality of a problem.

The `drift`

object's displayed parameters are:

`Rate`

: The drift-rate function,*F(t,X*_{t})`A`

: The intercept term,, of*A(t,X*_{t})*F(t,X*_{t})`B`

: The first order term,, of*B(t,X*_{t})*F(t,X*_{t})

`A`

and `B`

enable
you to query the original inputs. The function stored in `Rate`

fully
encapsulates the combined effect of `A`

and `B`

.

The `diffusion`

object's displayed parameters
are:

`Rate`

: The diffusion-rate function,.*G(t,X*_{t})`Alpha`

: The state vector exponent, which determines the format ofof*D(t,X*_{t}).*G(t,X*_{t})`Sigma`

: The volatility rate,, of*V(t,X*_{t}).*G(t,X*_{t})

Again, `Alpha`

and `Sigma`

enable
you to query the original inputs. (The combined effect of the individual `Alpha`

and `Sigma`

parameters
is fully encapsulated by the function stored in `Rate`

.)
The `Rate`

functions are the calculation engines
for the `drift`

and `diffusion`

objects,
and are the only parameters required for simulation.

The `sdeddo`

class
derives from the base`sde`

class.
To use this class, you must pass drift and diffusion-rate objects
to the `sdeddo`

constructor.

Create

`drift`

and`diffusion`

rate objects using the`drift`

and`diffusion`

constructors:F = drift(0, 0.1); % Drift rate function F(t,X) G = diffusion(1, 0.3); % Diffusion rate function G(t,X)

Pass these objects to the

`sdeddo`

constructor:`obj = sdeddo(F, G) % dX = F(t,X)dt + G(t,X)dW`

obj = Class SDEDDO: SDE from Drift and Diffusion Objects -------------------------------------------------- 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 A: 0 B: 0.1 Alpha: 1 Sigma: 0.3

In this example, the object displays the additional parameters associated with input drift and diffusion objects.

`bm`

| `cev`

| `cir`

| `diffusion`

| `drift`

| `gbm`

| `heston`

| `hwv`

| `interpolate`

| `sde`

| `sdeddo`

| `sdeld`

| `sdemrd`

| `simByEuler`

| `simBySolution`

| `simBySolution`

| `simulate`

| `ts2func`

Was this topic helpful?