mktrintree

Create recombining trinomial tree

Description

example

TrinTree = mktrintree(NumLevels,NumPos,NumStates) creates a recombining tree TrinTree with initial values NodeVal at each node.

example

TrinTree = mktrintree(___,NodeVal) adds an optional argument for NodeVal.

Examples

collapse all

Create a recombining trinomial tree of four time levels with a vector of two elements in each node and each element initialized to NaN.

TrinTree = mktrintree(4, [2 2 2 2], [1 3 5 7])
TrinTree=1×4 cell array
    {2x1 double}    {2x3 double}    {2x5 double}    {2x7 double}

Input Arguments

collapse all

Number of time levels of the tree, specified as a scalar numeric.

Data Types: double

Length of the state vectors in each time level, specified as a 1-by-NUMLEVELS vector.

Data Types: double

Number of state vectors in each level, specified as a 1-by-NUMLEVELS vector.

Data Types: double

(Optional) Initial value at each node of the tree, specified as a scalar numeric.

Data Types: double

Output Arguments

collapse all

Recombining trinomial tree, returned as a tree struct with initial values NodeVal at each node.

Introduced before R2006a