This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

cfdur

Cash-flow duration and modified duration

Syntax

[Duration,ModDuration] = cfdur(CashFlow,Yield)

Description

example

[Duration,ModDuration] = cfdur(CashFlow,Yield) calculates the duration and modified duration of a cash flow in periods.

Examples

collapse all

This example shows how to calculate the duration and modified duration of a cash flow, given a cash flow of nine payments of $2.50 and a final payment $102.50, with a periodic yield of 2.5%.

CashFlow=[2.5 2.5 2.5 2.5 2.5 2.5 2.5 2.5 2.5 102.5];

[Duration, ModDuration] = cfdur(CashFlow, 0.025)
Duration = 8.9709
ModDuration = 8.7521

Input Arguments

collapse all

Cash flow, specified as a vector or matrix of real numbers. When using a matrix, each column of the matrix is a separate CashFlow.

Data Types: double

Periodic yield, specified as a scalar decimal or a vector of decimals.

Data Types: double

Output Arguments

collapse all

Duration returned as a scalar or vector.

Modified duration, returned as a scalar or vector.

Introduced before R2006a