%% Compute the Price and Sensitivity From the Interest-Rate Term Structure
% This example shows how to price a portfolio containing two cash flow instruments paying interest annually over the four-year period from January 1, 2000 to January 1, 2004. Load the file deriv.mat, which provides ZeroRateSpec. The ZeroRateSpec structure contains the interest-rate information needed to price the instruments.

load deriv.mat 
CFlowAmounts =[5 NaN 5.5 105;5 0 6 105];
CFlowDates = [730852, NaN, 731582,731947; 
              730852, 731217, 731582, 731947];
Settle = 730486;
Price = cfbyzero(ZeroRateSpec, CFlowAmounts, CFlowDates, Settle)

% Copyright 2015 The MathWorks, Inc.