See also the time value of money for other related Matlab functions.
Download
nfvFlow.m
Introduction
The future value (FV) of a single lump sum of cash is its present value (PV, its value right now) plus interest earned over a period of time. The future value of a cash flow is the sum of the FVs of the money received (or spent) at each time period. As each time periods go by, the amount of periods over which a subsequent income can potentially earn interest reduces.
For an introduction to future values and simple and compound interest, and a simple Matlab function for calculating the future value of a lump sum, see this post.
nfvFlow.m is an alternative to Matlab's fvvar function in the financial toolbox. nfvFlow includes a flag that allows interest payments to be made in advance or in arrears (intPaid=1 for advance, or =0 for arrears). Payments (payments) and periods (periods) can be explicitly specified, or entered as a single value if regular (see below for examples). The interest rate (rate) should be a decimal value, not a percentage. The outputs give the overall net future value of the cash flow (nfv) and the future value of each payment made at each time point (fvAtPeriod).
[nfv, fvAtPeriod]= nfvFlow(payments, rate, periods, intPaid)
For example, for a regular payment of £2000, over 4 periods with a rate of 5% and interest paid at the end of time periods (see first example below for details):
[nfv, fvAtPeriod] = nfvFlow(2000, 0.05, 4, 0).
Leader
Showing posts with label Time value of money. Show all posts
Showing posts with label Time value of money. Show all posts
Monday, 4 May 2015
Wednesday, 8 April 2015
Alternative function: Net present value of a cash flow
See also the time value of money for other related Matlab functions.
Download
npvFlow.m
Introduction
The net present value (NPV) of a cash flow is how much a flow of cash is worth right now. The "net" part refers to the fact that the cash flow isn't necessarily fixed, and may even be negative at certain points in time. Matlab has two functions in the financial toolbox for calculating NPV for fixed and variable cash flows (pvfix and pvvar respectively), npvFlow.m is designed to emulate the basic function of both these functions and works for fixed and variable cash flows.
For example, consider a cash flow of £200 per year for the next 4 years, with an annual interest rate of 4%. What is the value of this cash flow right now, at this point in time? It's not £800, it must be less. To work it out, we need to calculate the present value of each individual chunk of cash. The NPV is simply the sum of these.
This is done with the PV calculation (pvLump,m) of each lump sum, which is
PV = FV / (1+r)^n,
where r = interest rate and n = number of time periods.
So,
End of period 1: £200 received = PV1 = 200/(1+0.04)^1 = 192
End of period 2: £200 received = PV2 = 200/(1+0.04)^2 = 185
End of period 3: £200 received = PV3 = 200/(1+0.04)^3 = 178
End of period 4: £200 received = PV4 = 200/(1+0.04)^4 = 171
The sum of PV1-4 = NPV = 192 + 185 + 178 + 171 = £725.
Download
npvFlow.m
Introduction
The net present value (NPV) of a cash flow is how much a flow of cash is worth right now. The "net" part refers to the fact that the cash flow isn't necessarily fixed, and may even be negative at certain points in time. Matlab has two functions in the financial toolbox for calculating NPV for fixed and variable cash flows (pvfix and pvvar respectively), npvFlow.m is designed to emulate the basic function of both these functions and works for fixed and variable cash flows.
For example, consider a cash flow of £200 per year for the next 4 years, with an annual interest rate of 4%. What is the value of this cash flow right now, at this point in time? It's not £800, it must be less. To work it out, we need to calculate the present value of each individual chunk of cash. The NPV is simply the sum of these.
This is done with the PV calculation (pvLump,m) of each lump sum, which is
PV = FV / (1+r)^n,
where r = interest rate and n = number of time periods.
So,
End of period 1: £200 received = PV1 = 200/(1+0.04)^1 = 192
End of period 2: £200 received = PV2 = 200/(1+0.04)^2 = 185
End of period 3: £200 received = PV3 = 200/(1+0.04)^3 = 178
End of period 4: £200 received = PV4 = 200/(1+0.04)^4 = 171
The sum of PV1-4 = NPV = 192 + 185 + 178 + 171 = £725.
Alternative function: Present value of lump sum
See also the time value of money for other related Matlab functions.
Download
pvLump.m
Introduction
The present value of a lump sum of cash is the value of cash available in the future, right now.
But why should the value of something be now compared to in the future? This is a core concept of what is known as the "time value of money", which basically states that money is worth more now than it is if received in the future. The reason for this is interest - if you have money now, you have the opportunity to earn interest on it. If you only get the money later, you miss this opportunity.
This concept also applies to cash flows, but is slightly more complex as the interest needs to be applied at multiple points in time - see npvFlow.m.
For example, for a lump sum, assuming a positive interest rate; £1000 in 2 years time is worth £1000 in 2 years, whereas £1000 now is worth £1000+2 years interest in 2 years time. But what is £1000 in 2 years time worth to us right now? This value is the present value (PV).
So, for a lump sum, the equation is a rearranged form of the future value (FV) compound interest equation (see fvLump.m). Intuitively, for compounding interest, the FV is the PV plus the interest from each time point:
FV = PV * (1+r)^n,
where r = interest rate and n = number of time periods.
This means to calculate the PV, the equation rearranges to:
PV = FV / (1+r)^n.
This is the equation we will implement in a simple Matlab function, pvLump.m.
Download
pvLump.m
Introduction
The present value of a lump sum of cash is the value of cash available in the future, right now.
But why should the value of something be now compared to in the future? This is a core concept of what is known as the "time value of money", which basically states that money is worth more now than it is if received in the future. The reason for this is interest - if you have money now, you have the opportunity to earn interest on it. If you only get the money later, you miss this opportunity.
This concept also applies to cash flows, but is slightly more complex as the interest needs to be applied at multiple points in time - see npvFlow.m.
For example, for a lump sum, assuming a positive interest rate; £1000 in 2 years time is worth £1000 in 2 years, whereas £1000 now is worth £1000+2 years interest in 2 years time. But what is £1000 in 2 years time worth to us right now? This value is the present value (PV).
So, for a lump sum, the equation is a rearranged form of the future value (FV) compound interest equation (see fvLump.m). Intuitively, for compounding interest, the FV is the PV plus the interest from each time point:
FV = PV * (1+r)^n,
where r = interest rate and n = number of time periods.
This means to calculate the PV, the equation rearranges to:
PV = FV / (1+r)^n.
This is the equation we will implement in a simple Matlab function, pvLump.m.
Alternative function: Future value of lump sum
See also the time value of money for other related Matlab functions.
Download
fvLump.m
Introduction
The future value (FV) of a single lump sum of cash is its present value (PV, see also pvLump.m and npvflow.m) plus interest earned over a period of time. Interest can be earned in two ways - simple interest or compound. Simple interest is linear and is a proportion of the original amount applied at the end of the time period. Compound interest, which is mostly commonly used, increases in an exponential fashion as it is added at each time period and adds to the amount on which the interest is applied in the next period. fvLump provides an alternative to fvdisc in the financial toolbox.
Simple interest
FV = PV * (1+r*t)
Compounding interest
FV = PV * (1+r)^t
Where r = interest rate and t = number of time periods.
These equations are available in fvLump. For calculating the future value of a cash flow, for example, when saving a regular amount of money and earning interest, see nfvFlow.m.
Download
fvLump.m
Introduction
The future value (FV) of a single lump sum of cash is its present value (PV, see also pvLump.m and npvflow.m) plus interest earned over a period of time. Interest can be earned in two ways - simple interest or compound. Simple interest is linear and is a proportion of the original amount applied at the end of the time period. Compound interest, which is mostly commonly used, increases in an exponential fashion as it is added at each time period and adds to the amount on which the interest is applied in the next period. fvLump provides an alternative to fvdisc in the financial toolbox.
Simple interest
FV = PV * (1+r*t)
Compounding interest
FV = PV * (1+r)^t
Where r = interest rate and t = number of time periods.
These equations are available in fvLump. For calculating the future value of a cash flow, for example, when saving a regular amount of money and earning interest, see nfvFlow.m.
Subscribe to:
Posts (Atom)