discountfactors
Description
Examples
Calculate Discount Factors for parametercurve
Object
Create a parametercurve
object using parametercurve
.
PCobj = parametercurve('zero',datetime(2019,9,15),@(t)polyval([-0.0001 0.003 0.02],t),'Compounding',4,'Basis',5,'Parameters',[-0.0001 0.003 0.02])
PCobj = parametercurve with properties: Type: "zero" Settle: 15-Sep-2019 Compounding: 4 Basis: 5 FunctionHandle: @(t)polyval([-0.0001,0.003,0.02],t) Parameters: [-1.0000e-04 0.0030 0.0200]
Compute the discount factors using discountfactors
.
CurveSettle = datetime(2019,9,15); outDF = discountfactors(PCobj,CurveSettle+30:30:CurveSettle+720)
outDF = 1×24
0.9983 0.9967 0.9949 0.9932 0.9914 0.9895 0.9876 0.9857 0.9838 0.9818 0.9798 0.9778 0.9757 0.9737 0.9715 0.9694 0.9673 0.9649 0.9627 0.9604 0.9581 0.9558 0.9535 0.9511
Input Arguments
obj
— parametercurve
object
parametercurve
object
parametercurve
object, specified as a previously created parametercurve
object.
Data Types: object
inpDates
— Input dates
datetime array | string array | date character vector
Input dates, specified as a scalar or an
NPOINTS
-by-1
vector using a datetime array,
string array, or date character vectors.
To support existing code, discountfactors
also
accepts serial date numbers as inputs, but they are not recommended.
Output Arguments
outDF
— Discount factors
numeric
Discount factors, returned as a numeric.
Version History
Introduced in R2020aR2022b: Serial date numbers not recommended
Although discountfactors
supports serial date numbers,
datetime
values are recommended instead. The
datetime
data type provides flexible date and time
formats, storage out to nanosecond precision, and properties to account for time
zones and daylight saving time.
To convert serial date numbers or text to datetime
values, use the datetime
function. For example:
t = datetime(738427.656845093,"ConvertFrom","datenum"); y = year(t)
y = 2021
There are no plans to remove support for serial date number inputs.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)