%% Compute the Price for a Cash Flow Given Yield to Maturity
% Use cfprice to compute the price for a cash flow given yield to maturity.
% Define data for the yield curve.

Settle = datenum('01-Jul-2003');
Yield = .05;
CFAmounts = [30;40;30];
CFDates = datenum({'15-Jul-2004', '15-Jul-2005', '15-Jul-2006'});

%
% Compute the Price.

Price = cfprice(CFAmounts, CFDates, Yield, Settle)

% Copyright 2012 The MathWorks, Inc.