# cvtree

Convert inverse-discount tree to interest-rate tree

## Syntax

``RateTree = cvtree(Tree)``

## Description

example

````RateTree = cvtree(Tree)` converts a tree structure using inverse-discount notation to a tree structure using rate notation for forward rates.```

## Examples

collapse all

Convert a Hull-White tree using inverse-discount notation to a Hull-White tree displaying interest-rate notation.

```load deriv.mat; HWTree```
```HWTree = struct with fields: FinObj: 'HWFwdTree' VolSpec: [1x1 struct] TimeSpec: [1x1 struct] RateSpec: [1x1 struct] tObs: [0 1 2 3] dObs: [731947 732313 732678 733043] CFlowT: {[4x1 double] [3x1 double] [2x1 double] } Probs: {[3x1 double] [3x3 double] [3x5 double]} Connect: { [2 3 4] [2 2 3 4 4]} FwdTree: {[1.0279] [1.0528 1.0356 1.0186] [1.0829 1.0652 1.0478 1.0306 1.0138] [1.0946 1.0767 1.0591 1.0418 1.0248]} ```
`HWTree.FwdTree{1}`
```ans = 1.0279 ```
`HWTree.FwdTree{2}`
```ans = 1×3 1.0528 1.0356 1.0186 ```

Use `treeviewer` to display the path of interest rates expressed in inverse-discount notation.

`treeviewer(HWTree)` Use `cvtree` to convert the inverse-discount notation to interest-rate notation.

`RTree = cvtree(HWTree)`
```RTree = struct with fields: FinObj: 'HWRateTree' VolSpec: [1x1 struct] TimeSpec: [1x1 struct] RateSpec: [1x1 struct] tObs: [0 1 2 3] dObs: [731947 732313 732678 733043] CFlowT: {[4x1 double] [3x1 double] [2x1 double] } Probs: {[3x1 double] [3x3 double] [3x5 double]} Connect: { [2 3 4] [2 2 3 4 4]} RateTree: {[0.0275] [0.0514 0.0349 0.0185] [0.0796 0.0632 0.0467 0.0302 0.0137] [0.0904 0.0739 0.0574 0.0409 0.0245]} ```
`RTree.RateTree{1}`
```ans = 0.0275 ```
`RTree.RateTree{2}`
```ans = 1×3 0.0514 0.0349 0.0185 ```

use `treeviewer` to display the converted tree, showing the path of interest rates expressed as forward rates.

`treeviewer(RTree)` ## Input Arguments

collapse all

Tree structure, specified by Heath-Jarrow-Morton, Black-Derman-Toy, Hull-White, Black-Karasinski, or Cox-Ingersoll-Ross tree structure that uses inverse-discount notation for forward rates.

Data Types: `struct`

## Output Arguments

collapse all

Tree structure using rate notation for forward rates, returned as a tree structure.

## Version History

Introduced before R2006a
{"ft_lang_label":"__label__en","ft_lang_prob":0.62511796,"math_prob":0.87091106,"size":2141,"snap":"2023-40-2023-50","text_gpt3_token_len":780,"char_repetition_ratio":0.1361722,"word_repetition_ratio":0.30463576,"special_character_ratio":0.38860345,"punctuation_ratio":0.17687075,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.97411066,"pos_list":[0,1,2,3,4],"im_url_duplicate_count":[null,1,null,1,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-09-30T00:29:44Z\",\"WARC-Record-ID\":\"<urn:uuid:54689174-a373-49a8-a562-7ae28aac5ec6>\",\"Content-Length\":\"89705\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:c54e7892-1cfe-46e1-b528-56b0d2c3704e>\",\"WARC-Concurrent-To\":\"<urn:uuid:aaa1c799-5f63-471a-97b1-14cc72f16d15>\",\"WARC-IP-Address\":\"23.34.160.82\",\"WARC-Target-URI\":\"https://nl.mathworks.com/help/fininst/cvtree.html\",\"WARC-Payload-Digest\":\"sha1:5DAEJZZQFDKUR27CPJL6X7I2SBFI3XIS\",\"WARC-Block-Digest\":\"sha1:FTFI3MTVEYNESADHCWOXHCS6RE2LPWD3\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-40/CC-MAIN-2023-40_segments_1695233510529.8_warc_CC-MAIN-20230929222230-20230930012230-00738.warc.gz\"}"}