Function File: [dur, mod_dur] = cfdur (cf, yield)

Calculate duration dur and modified duration mod_dur, from given fixed-paid cash flow cf and period yield yield.

Reference: http://en.wikipedia.org/wiki/Bond_duration Using periodic compounding instead of continuous compounding.

See also: cfconv.

Demonstration 1

The following code

 cf = [2.5 2.5 2.5 2.5 2.5 2.5 2.5 2.5 2.5 102.5];
 yield = 0.025;
 [ duration, modDuration ] = cfdur( cf, yield );
 %--------------------------------------------------
 % Input cash flow and yield, output duration and modified duration

gives an example of how 'cfdur' is used.

Package: financial