%% Price a 3% Cap Instrument Using an HJM Forward-Rate Tree
% Load the file deriv.mat, which provides HJMTree. The HJMTree structure contains the time and forward-rate information needed to price the cap instrument.

load deriv.mat;

%
% Set the required values. Other arguments will use defaults.

Strike = 0.03;
Settle = '01-Jan-2000';
Maturity = '01-Jan-2004';

%
% Use capbyhjm to compute the price of the cap instrument.

Price = capbyhjm(HJMTree, Strike, Settle, Maturity)

% Copyright 2015 The MathWorks, Inc.