Dates from time and frequency
Dates = time2date(Settle,Times,Compounding,Basis,EndMonthRule)
| Settlement date. A vector of serial date numbers or date character vectors. |
| Vector of times corresponding to the compounding value. |
| (Optional) Scalar value representing the rate at which
the input zero rates were compounded when annualized. Default =
|
| (Optional) Day-count basis of the instrument. A vector of integers.
For more information, see Basis. |
| (Optional) End-of-month rule. A vector. This rule applies
only when |
Dates = time2date(Settle,Times,Compounding,Basis,EndMonthRule)
computes
dates corresponding to compounded rate quotes between Settle
and
time factors.
To obtain accurate results from this function, the Basis
and Dates
arguments
must be consistent. If the Dates
argument contains
months that have 31 days, Basis
must be one of
the values that allow months to contain more than 30 days; for example, Basis
= 0
, 3
,
or 7
.
The time2date
function is the inverse of date2time
.
Show that date2time
and time2date
are
the inverse of each other. First compute the time factors using date2time
.
Settle = '1-Sep-2002'; Dates = datenum(['31-Aug-2005'; '28-Feb-2006'; '15-Jun-2006'; '31-Dec-2006']); Compounding = 2; Basis = 0; EndMonthRule = 1; Times = date2time(Settle, Dates, Compounding, Basis,... EndMonthRule)
Times = 5.9945 6.9945 7.5738 8.6576
Now use the calculated Times
in time2date
and
compare the calculated dates with the original set.
Dates_calc = time2date(Settle, Times, Compounding, Basis,... EndMonthRule) Dates_calc = 732555 732736 732843 733042 datestr(Dates_calc)
ans = 31-Aug-2005 28-Feb-2006 15-Jun-2006 31-Dec-2006