%% Compute the Price of an Amortizing Cap Using the HJM Model
% Load deriv.mat to specify the HJMTree and then define the cap instrument.

load deriv.mat; 
Settle = '01-Jan-2000';
Maturity = '01-Jan-2004';
Strike = 0.045;
CapReset = 1;
Principal ={{'01-Jan-2001' 100;'01-Jan-2002' 80;'01-Jan-2003' 70;'01-Jan-2004' 30}};

%
% Price the amortizing cap.

Basis = 1;
Price = capbyhjm(HJMTree, Strike, Settle, Maturity, CapReset, Basis, Principal)

% Copyright 2015 The MathWorks, Inc.