Documentation 
Price bonds with embedded options by BlackKarasinski interestrate tree
[Price, PriceTree] = optembndybk(BKTree,
CouponRate,
Settle, Maturity, OptSpec, Strike, Strike,
ExerciseDates,
'Name1', Value1, 'Name2', Value2, ...)
BKTree  Interestrate tree structure created by bktree. 
CouponRate  Decimal annual rate. CouponRate is a NINSTby1 vector or NINSTby1 cell array of decimal annual rates, or decimal annual rate schedules. For the latter case of a variable coupon schedule, each element of the cell array is a NumDatesby2 cell array, where the first column is dates and the second column is its associated rate. The date indicates the last day that the coupon rate is valid. 
Settle  NINSTby1 matrix for the settlement date. A vector of serial date numbers or date strings. Settle must be earlier than Maturity. 
Maturity  NINSTby1 matrix for the maturity date. A vector of serial date numbers or date strings. 
OptSpec  NINSTby1 cell array of strings 'call' or 'put'. 
Strike  European option: NINSTby1 vector of strike price values. Bermuda option: NINST by number of strikes (NSTRIKES) matrix of strike price values. Each row is the schedule for one option. If an option has fewer than NSTRIKES exercise opportunities, the end of the row is padded with NaNs. For an American option: NINSTby1 vector of strike price values for each option. 
ExerciseDates  NINSTby1 (European option) or NINSTbyNSTRIKES (Bermuda option) matrix of exercise dates. Each row is the schedule for one option. For a European option, there is only one exercise date, the option expiry date. For an American option: NINSTby2 vector of exercise date boundaries. For each instrument, the option can be exercised on any coupon date between or including the pair of dates on that row. If only one nonNaN date is listed, or if ExerciseDates is NINSTby1, the option can be exercised between the underlying bond Settle and the single listed exercise date. 
(Optional) The name/value pairs are a variable length list of parameters. All optional inputs are specified as matching parameter name/value pairs. The parameter name is specified as a character string, followed by the corresponding parameter value. Parameter name/value pairs may be specified in any order; names are case insensitive and partial string matches are allowed provided no ambiguities exist. Valid parameter names are as follows:

[Price, PriceTree] = optembndybk(BKTree,
CouponRate,
Settle, Maturity, OptSpec, Strike, Strike,
ExerciseDates,
'Name1', Value1, 'Name2', Value2, ...) prices
bonds with embedded options by a BK interestrate tree.
Price is a number of instruments (NINST)by1 matrix of expected prices at time 0.
PriceTree is a structure of trees containing vectors of instrument prices and observation times for each node. Within PriceTree:
PriceTree.PTree contains the clean prices.
PriceTree.tObs contains the observation times.
optembndbybk computes prices of vanilla bonds with embedded options, stepped coupon bonds with embedded options, and bonds with sinking fund option provisions.
bkprice  bktree  cfamounts  instoptembnd