Why do I get "have cash flows dates that span across tree nodes." error, when using swaptionbyhw

2 views (last 30 days)
I am trying to calibrate hull white one factor model using volatility surface and zero curve
at following lines
TimeSpec = hwtimespec(Settle,daysadd(Settle,360*([1:11]),1), 2);
HW1Fobjfun = @(x) SwaptionBlackPrices(relidx) - ...
swaptionbyhw(hwtree(hwvolspec(Settle,datetime(2034,11,11),x(2),datetime(2034,11,11),x(1)), RateSpec, TimeSpec), 'call', SwaptionStrike(relidx),...
EurExDatesFull(relidx), 0, EurExDatesFull(relidx), EurMatFull(relidx));
options = optimset('disp','iter','MaxFunEvals',1000,'TolFun',1e-8);
I received warning "Warning: Not all cash flows aligned with the tree. Result will be approximated. " and a error
"Error using cummswapcfbytrintree (line 161)
Instruments {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
35 36 46 47 48 49 50 51 52 53 } have cash flows dates that span across tree nodes."
However, when I remove "6mo" and "1.5Yr" rows from the volatility matrix, my code could run without any errors and quickly found optimal solution.
What is the cause of this error? And How can it be addressed?

Answers (0)

Products


Release

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!