%% Stripping Floorlet Volatilities from At-The-Money (ATM) Floors
% Compute the zero curve for discounting and projecting forward rates.

ValuationDate = datenum('10-Aug-2015');
ZeroRates = [0.12 0.24 0.40 0.73 1.09 1.62]/100;             
CurveDates = datemnth(ValuationDate, [0.25 0.5 1 2 3 5]*12);
ZeroCurve = IRDataCurve('Zero',ValuationDate,CurveDates,ZeroRates)

%
% Define the ATM floor volatility data.

FloorSettle = datenum('12-Aug-2015');
FloorMaturity = datenum({'12-Aug-2016';'14-Aug-2017';'13-Aug-2018';...
    '12-Aug-2019',;'12-Aug-2020'});
FloorVolatility = [0.31;0.39;0.43;0.42;0.40];

%
% Strip floorlet volatilities from ATM floors.

[FloorletVols, FloorletPaymentDates, ATMFloorStrikes] = floorvolstrip(ZeroCurve,...
    FloorSettle, FloorMaturity, FloorVolatility);

PaymentDates = cellstr(datestr(FloorletPaymentDates));
format;
table(PaymentDates, FloorletVols, ATMFloorStrikes)

% Copyright 2012 The MathWorks, Inc.