%% Price an Amortizing Floor Using a Linear Gaussian Two-Factor Model
% Define the ZeroCurve, a, b, sigma, eta, rho, and Notional parameters for the amortizing floor.

Settle = datenum('15-Dec-2007');
% Define ZeroCurve
ZeroTimes = [3/12 6/12 1 5 7 10 20 30]';
ZeroRates = [0.033 0.034 0.035 0.040 0.042 0.044 0.048 0.0475]';
CurveDates = daysadd(Settle,360*ZeroTimes);

irdc = IRDataCurve('Zero',Settle,CurveDates,ZeroRates);

% Define a, b, sigma, eta, and rho
a = .07;
b = .5;
sigma = .01;
eta = .006;
rho = -.7;

% Define the amortizing floors
FloorMaturity = daysadd(Settle,360*[1:5 7 10 15 20 25 30],1);
Strike = [0.025 0.036 0.037 0.038 0.039 0.041 0.043 0.045 0.046 0.046 0.046]';
Notional = {{'15-Dec-2012' 100;'15-Dec-2017' 70;'15-Dec-2022' 40;'15-Dec-2037' 10}};

% Price the amortizing floors
Price = floorbylg2f(irdc,a,b,sigma,eta,rho,Strike,FloorMaturity,'Notional',Notional)

% Copyright 2015 The MathWorks, Inc.