%% Compute the Yield to Maturity of a Certificate of Deposit Using datetime Inputs
% This example shows how to use datetime inputs to compute the yield on the certificate of deposit (CD), given a CD with the following characteristics.

Price      = 101.125;
CouponRate = 0.05;
Settle     = datetime('02-Jan-02','Locale','en_US');
Maturity   = datetime('31-Mar-02','Locale','en_US');
IssueDate = datetime('1-Oct-01','Locale','en_US');

Yield = cdyield(Price, CouponRate, Settle, Maturity, IssueDate)

% Copyright 2012 The MathWorks, Inc.