%% Create a Two-Factor Additive Gaussian Interest-Rate Model Using a RateSpec
% Create a two-factor additive Gaussian interest-rate model using a RateSpec.

Settle = datenum('15-Dec-2007');
CurveTimes = [1:5 7 10 20]';
ZeroRates = [.01 .018 .024 .029 .033 .034 .035 .034]';
CurveDates = daysadd(Settle,360*CurveTimes,1);
 
RateSpec = intenvset('Rates',ZeroRates,'EndDates',CurveDates,'StartDate',Settle);
    
a = .07;
b = .5;
sigma = .01;
eta = .006;
rho = -.7;
 
G2PP = LinearGaussian2F(RateSpec,a,b,sigma,eta,rho)

%
% Use the simTermStructs method to simulate term structures based on the LinearGaussian2F model.

 SimPaths = simTermStructs(G2PP, 10,'nTrials',100);

% Copyright 2012 The MathWorks, Inc.