Financial Toolbox™ cash-flow functions compute interest rates and rates of return, present or future values, depreciation streams, and annuities.

Some examples in this section use this income stream: an initial investment of $20,000 followed by three annual return payments, a second investment of $5,000, then four more returns. Investments are negative cash flows, return payments are positive cash flows.

```
Stream = [-20000, 2000, 2500, 3500, -5000, 6500,...
9500, 9500, 9500];
```

Several functions calculate interest rates involved with cash flows. To compute the internal rate of return of the cash stream, execute the toolbox function `irr`

ROR = irr(Stream)

which gives a rate of return of 11.72%.

The internal rate of return of a cash flow may not have a unique value. Every time the sign changes in a cash flow, the equation defining `irr`

can give up to two additional answers. An `irr`

computation requires solving a polynomial equation, and the number of real roots of such an equation can depend on the number of sign changes in the coefficients. The equation for internal rate of return is

$$\frac{c{f}_{1}}{\left(1+r\right)}+\frac{c{f}_{2}}{{\left(1+r\right)}^{2}}+\dots +\frac{c{f}_{n}}{{\left(1+r\right)}^{n}}+Investment=0,$$

where *Investment* is a (negative) initial cash outlay at time 0, *cf*_{n} is the cash flow in the *n*th period, and *n* is the number of periods. `irr`

finds the rate *r* such that the present value of the cash flow equals the initial investment. If all the *cf*_{n}s are positive there is only one solution. Every time there is a change of sign between coefficients, up to two additional real roots are possible.

Another toolbox rate function, `effrr`

, calculates the effective rate of return given an annual interest rate (also known as nominal rate or annual percentage rate, APR) and number of compounding periods per year. To find the effective rate of a 9% APR compounded monthly, enter

Rate = effrr(0.09, 12)

The answer is 9.38%.

A companion function `nomrr`

computes the nominal rate of return given the effective annual rate and the number of compounding periods.

The toolbox includes functions to compute the present or future value of cash flows at regular or irregular time intervals with equal or unequal payments: `fvfix`

, `fvvar`

, `pvfix`

, and `pvvar`

. The `-fix`

functions assume equal cash flows at regular intervals, while the `-var`

functions allow irregular cash flows at irregular periods.

Now compute the net present value of the sample income stream for which you computed the internal rate of return. This exercise also serves as a check on that calculation because the net present value of a cash stream at its internal rate of return should be zero. Enter

NPV = pvvar(Stream, ROR)

which returns an answer very close to zero. The answer usually is not *exactly* zero due to rounding errors and the computational precision of the computer.

**Note**

Other toolbox functions behave similarly. The functions that compute a bond's yield, for example, often must solve a nonlinear equation. If you then use that yield to compute the net present value of the bond's income stream, it usually does not *exactly* equal the purchase price, but the difference is negligible for practical applications.

The toolbox includes functions to compute standard depreciation schedules: straight line, general declining-balance, fixed declining-balance, and sum of years' digits. Functions also compute a complete amortization schedule for an asset, and return the remaining depreciable value after a depreciation schedule has been applied.

This example depreciates an automobile worth $15,000 over five years with a salvage value of $1,500. It computes the general declining balance using two different depreciation rates: 50% (or 1.5), and 100% (or 2.0, also known as double declining balance). Enter

Decline1 = depgendb(15000, 1500, 5, 1.5) Decline2 = depgendb(15000, 1500, 5, 2.0)

which returns

Decline1 = 4500.00 3150.00 2205.00 1543.50 2101.50 Decline2 = 6000.00 3600.00 2160.00 1296.00 444.00

These functions return the actual depreciation amount for the first four years and the remaining depreciable value as the entry for the fifth year.

Several toolbox functions deal with annuities. This first example shows how to compute the interest rate associated with a series of loan payments when only the payment amounts and principal are known. For a loan whose original value was $5000.00 and which was paid back monthly over four years at $130.00/month:

Rate = annurate(4*12, 130, 5000, 0, 0)

The function returns a rate of 0.0094 monthly, or about 11.28% annually.

The next example uses a present-value function to show how to compute the initial principal when the payment and rate are known. For a loan paid at $300.00/month over four years at 11% annual interest

Principal = pvfix(0.11/12, 4*12, 300, 0, 0)

The function returns the original principal value of $11,607.43.

The final example computes an amortization schedule for a loan or annuity. The original value was $5000.00 and was paid back over 12 months at an annual rate of 9%.

```
[Prpmt, Intpmt, Balance, Payment] = ...
amortize(0.09/12, 12, 5000, 0, 0);
```

This function returns vectors containing the amount of principal paid,

Prpmt = [399.76 402.76 405.78 408.82 411.89 414.97 418.09 421.22 424.38 427.56 430.77 434.00]

the amount of interest paid,

Intpmt = [37.50 34.50 31.48 28.44 25.37 22.28 19.17 16.03 12.88 9.69 6.49 3.26]

the remaining balance for each period of the loan,

Balance = [4600.24 4197.49 3791.71 3382.89 2971.01 2556.03 2137.94 1716.72 1292.34 864.77 434.00 0.00]

and a scalar for the monthly payment.

Payment = 437.26

`effrr`

| `fvfix`

| `fvvar`

| `irr`

| `nomrr`

| `pvfix`

| `pvvar`