Skip to Main Content Skip to Search
Product Documentation

bushshape - Retrieve shape of bushy tree

Syntax

[NumLevels, NumChild, NumPos, NumStates,
Trim] = bushshape(Tree)

Arguments

Tree

Bushy tree.

Description

[NumLevels, NumChild, NumPos, NumStates, Trim] = bushshape(Tree) returns information on a bushy tree's shape.

NumLevels is the number of time levels of the tree.

NumChild is a 1-by-number of levels (NUMLEVELS) vector with the number of branches (children) of the nodes in each level.

NumPos is a 1-by-NUMLEVELS vector containing the length of the state vectors in each level.

NumStates is a 1-by-NUMLEVELS vector containing the number of state vectors in each level.

Trim is 1 if NumPos decreases by 1 when moving from one time level to the next. Otherwise, it is 0.

Examples

Create an HJM tree by loading the example file.

load deriv.mat; 

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

With this tree

[NumLevels, NumChild, NumPos, NumStates, Trim] =... 
bushshape(HJMTree.FwdTree) 

returns

NumLevels  =   
     4

NumChild   =   
     2     2     2     0

NumPos     =   
     4     3     2     1

NumStates  =  
     1     2     4     8

Trim =   
     1

You can recreate this tree using the mkbush function.

Tree = mkbush(NumLevels, NumChild(1), NumPos(1), Trim); 
Tree = mkbush(NumLevels, NumChild, NumPos);

See Also

bushpath | mkbush

  


Free Interactive Computational Finance CD

View demos and recorded presentations led by industry experts.

Now On Demand
Network with industry peers and learn the latest applications of the leading software product for computational finance.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS