%% Compute the Price of Two Amortizing Caps Using the Black Model
% Define the RateSpec.

Rates = [0.0358; 0.0421; 0.0473; 0.0527; 0.0543];
ValuationDate = '15-Nov-2011';
StartDates = ValuationDate;
EndDates = {'15-Nov-2012';'15-Nov-2013';'15-Nov-2014' ;'15-Nov-2015';'15-Nov-2016'};
Compounding = 1;
RateSpec = intenvset('ValuationDate', ValuationDate,'StartDates', StartDates,...
             'EndDates', EndDates,'Rates', Rates, 'Compounding', Compounding)

%
% Define the cap instruments.

Settle ='15-Nov-2011';
Maturity = '15-Nov-2015';
Strike = [0.03;0.035];
Reset = 1;
Principal ={{'15-Nov-2012' 100;'15-Nov-2013' 70;'15-Nov-2014' 40;'15-Nov-2015' 10}};

%
% Price the amortizing caps.

Volatility = 0.10;  
Price = capbyblk (RateSpec, Strike, Settle, Maturity, Volatility,...
'Reset', Reset,'Principal', Principal)

% Copyright 2015 The MathWorks, Inc.