%% Price a Bond Using a BK Tree
% Price a 4% bond using a Black-Karasinski interest-rate tree.
% Load deriv.mat, which provides BKTree. The BKTree structure contains the time and interest-rate information needed to price the bond.

load deriv.mat;

%
% Define the bond using the required arguments. Other arguments use defaults.

CouponRate = 0.04;
Settle = '01-Jan-2004';
Maturity = '1-Jan-2008';

%
% Use bondbybk to compute the price of the bond.

Period = 1;
Price = bondbybk(BKTree, CouponRate, Settle, Maturity, Period)

% Copyright 2015 The MathWorks, Inc.