%% Compute the Price of a Bond Option From an HJM Forward-Rate Tree
% Using the HJM forward-rate tree in the deriv.mat file, price a European call option on a 4% bond with a strike of 96. The exercise date for the option is Jan. 01, 2003. The settle date for the bond is Jan. 01, 2000, and the maturity date is Jan. 01, 2004. Load the file deriv.mat, which provides HJMTree. The HJMTree structure contains the time and forward-rate information needed to price the bond.

load deriv.mat;

%
% Use the function| optbondbyhjm| to compute the price of the option.

Price = optbndbyhjm(HJMTree,'Call',96,'01-Jan-2003',... 
0,0.04,'01-Jan-2000','01-Jan-2004')

% Copyright 2015 The MathWorks, Inc.