Main Content

mktree

Create recombining binomial tree

Description

example

Tree = mktree(NumLevels,NumPos) creates a recombining tree Tree with initial values NodeVal at each node.

example

Tree = mktree(___,NodeVal,IsPriceTree) adds optional arguments for NodeVal and IsPriceTree.

Examples

collapse all

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

Tree = mktree(4, 2)
Tree=1×4 cell array
    {2x1 double}    {2x2 double}    {2x3 double}    {2x4 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

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

Data Types: double

(Optional) Indicator if final horizontal branch is added to tree, specified as a scalar logical value.

Data Types: logical

Output Arguments

collapse all

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

Introduced before R2006a