The reason this error is thrown out is the mis-alignment between the dates in the Black-Karasinski tree that you built and the cash flow dates.
The way the tree in your use case is set up makes it impossible to determine the applicable rate used to compute the payoff at the tree nodes. The reason is that the information is lost during the recombination of the tree nodes.
One way to remedy this issue is to place the tree levels at the cash flow dates of the instrument, which is done when specifying the Time Specs in the BK tree.
Once you set up the Rate and Volatility Specs of the BK tree, you would need to define the Time Specs as follows:
Basis = intenvget(RateSpec, 'Basis');
EOM = intenvget(RateSpec, 'EndMonthRule');
resetDates = cfdates(ValuationDate, Maturity, resetVector, Basis, EOM);
BKTimeSpec = bktimespec(RateSpec.ValuationDate, resetDates, resetVector);
BKT = bktree(BKVolatilitySpec, RateSpec, BKTimeSpec);
Price = floatbybk(BKT, Spread, RateSpec.ValuationDate, ...
Maturity, 'Reset', resetVector)
where 'ValuationDate', 'Maturity',' etc. were used to define the FRN parameters.
Best Answer