bushshape
Retrieve shape of bushy tree
Description
Examples
Retrieve Shape of Bushy Tree
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.
treeviewer(HJMTree)
Use bushshape
with the HJMTree
.
[NumLevels, NumChild, NumPos, NumStates, Trim] = bushshape(HJMTree.FwdTree)
NumLevels = 4
NumChild = 1×4
2 2 2 0
NumPos = 1×4
4 3 2 1
NumStates = 1×4
1 2 4 8
Trim = logical
1
You can recreate this tree using the mkbush
function.
Tree = mkbush(NumLevels, NumChild(1), NumPos(1), Trim)
Tree=1×4 cell array
{4x1 double} {3x1x2 double} {2x2x2 double} {1x4x2 double}
Tree = mkbush(NumLevels, NumChild, NumPos)
Tree=1×4 cell array
{4x1 double} {3x1x2 double} {2x2x2 double} {1x4x2 double}
Input Arguments
Tree
— Bushy tree
structure
Bushy tree, specified using an HJM, BDT, HW, BK, or CIR tree.
Data Types: struct
Output Arguments
NumLevels
— Number of tree levels
numeric
Number of tree levels, returned as a numeric.
NumChild
— Number of branches of the nodes in each level
vector
Number of branches (children) of the nodes in each level, returned as
a 1
-by-number of levels
(NUMLEVELS
) vector.
NumPos
— Length of the state vectors in each level
vector
Length of the state vectors in each level, returned as a
1
-by-number of levels
(NUMLEVELS
) vector.
NumStates
— Number of state vectors in each level
vector
Number of state vectors in each levels, returned as a
1
-by-number of levels
(NUMLEVELS
) vector.
Trim
— Trim
numeric
Trim, returned as a 1
if NumPos
decreases by 1
when moving from one time level to
the next. Otherwise, it is 0
.
Version History
Introduced before R2006a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)