%% Construct a Zero Curve
% This example shows how to use ZeroRates for a zero curve that is hard-coded. You can also create a zero curve by bootstrapping the zero curve from market data (for example, deposits, futures/forwards, and swaps)
% The hard-coded data for the zero curve is defined as:

Settle = datenum('21-Jul-2008');

% Zero Curve
CurveDates = daysadd(Settle,360*([1 3 5 7 10 20]),1);
ZeroRates = [1.9 2.6 3.1 3.5 4 4.3]'/100;

plot(CurveDates,ZeroRates)
datetick
title(['Zero Curve for ' datestr(Settle)]);

%
% Construct an IRDataCurve object.

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

%
% Create the RateSpec using intenvset.

RateSpec = intenvset('Rates',ZeroRates,'EndDates',CurveDates,'StartDate',Settle)

% Copyright 2015 The MathWorks, Inc.