%% Compute an Implied Forward Rate Curve Given a Zero Curve and Maturity Dates
% Given a zero curve over a set of maturity dates, a settlement date, and a compounding rate, compute the forward rate curve.

ZeroRates = [0.0458
             0.0502
             0.0518
             0.0519
             0.0524
             0.0519
             0.0523
             0.0525
             0.0541
             0.0529];

CurveDates = [datenum('06-Nov-2000')
             datenum('11-Dec-2000')
             datenum('15-Jan-2001')
             datenum('05-Feb-2001')
             datenum('04-Mar-2001')
             datenum('02-Apr-2001')
             datenum('30-Apr-2001')
             datenum('25-Jun-2001')
             datenum('04-Sep-2001')
             datenum('12-Nov-2001')];

Settle = datenum('03-Nov-2000');
InputCompounding = 1;
InputBasis = 2;
OutputCompounding = 1;
OutputBasis = 2;

%
% Execute the function zero2fwd to return the forward rate curve ForwardRates at the maturity dates CurveDates.

[ForwardRates, CurveDates] = zero2fwd(ZeroRates, CurveDates,...
Settle, 'InputCompounding',1,'InputBasis',2,'OutputCompounding',1,'OutputBasis',2)

% Copyright 2012 The MathWorks, Inc.