Present value of varying cash flow


PresentVal = pvvar(CashFlow,Rate,CFDates)



A vector of varying cash flows. Include the initial investment as the initial cash flow value (a negative number). If CashFlow is a matrix, each column is treated as a separate cash-flow stream.


Periodic interest rate. Enter as a decimal fraction. If CashFlow is a matrix, a scalar Rate is allowed when the same rate applies to all cash-flow streams in CashFlow. When multiple cash-flow streams require different discount rates, Rate must be a vector whose length equals the number of columns in CashFlow.


(Optional) A vector of serial date numbers, date character vectors, or datetime arrays on which the cash flows occur. Specify CFDates when there are irregular (nonperiodic) cash flows. The default assumes that CashFlow contains regular (periodic) cash flows. If CashFlow is a matrix, and all cash-flow streams share the same dates, CFDates can be a vector whose length matches the number of rows in CashFlow. When different cash-flow streams have different payment dates, specify CFDates as a matrix the same size as CashFlow.


PresentVal = pvvar(CashFlow,Rate,CFDates) returns the net present value of a varying cash flow. Present value is calculated at the time the first cash flow occurs.


This cash flow represents the yearly income from an initial investment of $10,000. The annual interest rate is 8%.

Year 1


Year 2


Year 3


Year 4


Year 5


To calculate the net present value of this regular cash flow

PresentVal = pvvar([-10000 2000 1500 3000 3800 5000], 0.08)


PresentVal =


An investment of $10,000 returns this irregular cash flow. The original investment and its date are included. The periodic interest rate is 9%.

Cash Flow



January 12, 1987


February 14, 1988


March 3, 1988


June 14, 1988


December 1, 1988

To calculate the net present value of this irregular cash flow

CashFlow = [-10000, 2500, 2000, 3000, 4000];

CFDates = ['01/12/1987'

PresentVal = pvvar(CashFlow, 0.09, CFDates)


PresentVal =


The net present value of the same investment under different discount rates of 7%, 9%, and 11% is obtained in a single call:

PresentVal = pvvar(repmat(CashFlow,3,1)', [.07 .09 .11], CFDates)
pv =

  419.0136  142.1648 -122.1275

Introduced before R2006a