%% Compute the Price of an Amortizing and Vanilla Caps Using the BK Model
% Load deriv.mat to specify the BKTree and then define the cap instrument.

load deriv.mat; 
Settle = '01-Jan-2004';
Maturity = '01-Jan-2008';
Strike = 0.05;
CapReset = 1;
Principal ={{'01-Jan-2005' 100;'01-Jan-2006' 60;'01-Jan-2007' 30;'01-Jan-2008' 30};...
            100};

%
% Price the amortizing and vanilla caps.

Basis = 1;
Price = capbybk(BKTree, Strike, Settle, Maturity, CapReset, Basis, Principal)

% Copyright 2015 The MathWorks, Inc.