%% Price a Bond Using an HJM Tree
% Price a 4% bond using an HJM interest-rate tree.
% Load deriv.mat, which provides HJMTree. The HJMTree 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-2000';
Maturity = '01-Jan-2004';

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

Period = 1;
Price = bondbyhjm(HJMTree, CouponRate, Settle, Maturity, Period)

% Copyright 2015 The MathWorks, Inc.