Main Content

treeshape

Shape of recombining binomial tree

Description

[NumLevels,NumPos,IsPriceTree] = treeshape(Tree) returns information on a recombining binomial tree's shape.

example

Examples

collapse all

This example shows how to obtain information on a recombining binomial tree's shape.

Create a BDT tree by loading the example file.

load deriv.mat; 

With treeviewer you can see the general shape of the BDT interest-rate tree.

treeviewer(BDTTree)

Figure Tree Viewer contains 2 axes objects and other objects of type uicontrol. Axes object 1 contains 22 objects of type line. Axes object 2 is empty.

Use treeshape to display the shape of the binomial tree.

[NumLevels, NumPos, IsPriceTree] = treeshape(BDTTree.FwdTree) 
NumLevels = 
4
NumPos = 1×4

     1     1     1     1

IsPriceTree = logical
   0

Input Arguments

collapse all

Recombining binomial tree, specified as a struct that is created using one of the following functions:

Data Types: struct

Output Arguments

collapse all

Number of time levels of tree, returned as a numeric.

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

Indicates if final horizontal branch is present in the tree, returned as a Boolean.

Version History

Introduced before R2006a