I'm new to Matlab and reading Numerical Methods in Finance 开发者_运维技巧so this should be a basic question. The code in the book is as follows:
settle = '19-Mar-2000';
maturity = '15-Jun-2015';
face = 1000;
couponRate = 0.05;
yields = 0.01:0.01:0.20;
[cleanPrices , accrInts] = bndprice(yields, couponRate, settle, maturity, 2, 0, [],[],[],[],[],face);
However it returns the following error
??? Error using ==> rdivide Matrix dimensions must agree.
Error in ==> bndprice at 218 PerDisc = 1./(1 + Yield./Frequency);
If I put in a single yield it works fine. Any clue as to why there is an issue with the yields?
you're going to find this ridiculous, but you need to rearrange yields...
[cleanPrices , accrInts] = bndprice(yields', couponRate, settle, maturity, 2, 0, [],[],[],[],[],face);
ahh when the small things go wrong
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论