xirr
Internal rate of return for nonperiodic cash flow
Description
returns the internal rate of return for a schedule of
nonperiodic cash flows.Return
= xirr(CashFlow
,CashFlowDates
)
adds optional arguments.Return
= xirr(___,Guess
,MaxIterations
,Basis
)
Examples
Find Internal Rate of Return for Nonperiodic Cash Flow
Find the internal rate of return for an investment of $10,000 that returns the following nonperiodic cash flow. The original investment is the first cash flow and is a negative number.
Cash Flow Dates
-10000 12-Jan-2007
2500 14-Feb-2008
2000 03-Mar-2008
3000 14-Jun-2008
4000 01-Dec-2008
Calculate the internal rate of return for this nonperiodic cash flow:
CashFlow = [-10000, 2500, 2000, 3000, 4000]; CashFlowDates = ['01/12/2007' '02/14/2008' '03/03/2008' '06/14/2008' '12/01/2008']; Return = xirr(CashFlow, CashFlowDates)
Return = 0.1006
Alternatively, you can use datetime input to calculate the internal rate of return for this nonperiodic cash flow:
CashFlow = [-10000, 2500, 2000, 3000, 4000]; CashFlowDates = ['01/12/2007' '02/14/2008' '03/03/2008' '06/14/2008' '12/01/2008']; CashFlowDates = datetime(CashFlowDates,'Locale','en_US')'; Return = xirr(CashFlow, CashFlowDates)
Return = 0.1006
Input Arguments
CashFlow
— Cash flow
vector | matrix
Cash flow, specified as a vector or matrix. The
first entry is the initial investment. If
CashFlow
is a matrix, each
column represents a separate stream of cash flows
whose internal rate of return is calculated. The
first cash flow of each stream is the initial
investment, usually entered as a negative
number.
Data Types: double
CashFlowDates
— Cash flow dates
serial date number | date character vector | datetime
Cash flow dates, specified as a vector or matrix
of serial date numbers, cell array of date
character vectors, or datetime arrays. The size of
the input date numbers for
CashFlowDates
must the same
size as CashFlow
. Each column
of CashFlowDate
represents the
dates of the corresponding column of
CashFlow
.
Data Types: double
| char
| datetime
| cell
Guess
— Initial estimate of the internal rate of return
0.1
(10%) (default) | numeric
(Optional) Initial estimate of the internal rate
of return, specified as a scalar or vector. If
Guess
is a scalar, then it is
applied to all streams, and if
Guess
is a vector, then it is
the same length as the number of streams.
Data Types: double
MaxIterations
— Number of iterations used by Newton's method to solve the internal rate of return
50
(default) | positive integer
(Optional) Number of iterations used by Newton's
method to solve the internal rate of return,
specified as a scalar or vector of positive
integers. If MaxIterations
is a
scalar, then it is applied to all streams, and if
MaxIterations
is a vector, then
it is the same length as the number of
streams.
Data Types: double
Basis
— Day-count basis
0
(actual/actual) (default) | positive integers of the set
[1...13]
| vector of positive integers of the set
[1...13]
(Optional) Day-count basis, specified as a
positive integer using scalar or a
N
-by-1
vector. If Basis
is a scalar,
then it is applied to all streams, and if
Basis
is a vector, then it is
the same length as the number of streams.
0 = actual/actual
1 = 30/360 (SIA)
2 = actual/360
3 = actual/365
4 = 30/360 (PSA)
5 = 30/360 (ISDA)
6 = 30/360 (European)
7 = actual/365 (Japanese)
8 = actual/actual (ICMA)
9 = actual/360 (ICMA)
10 = actual/365 (ICMA)
11 = 30/360E (ICMA)
12 = actual/365 (ISDA)
13 = BUS/252
For more information, see Basis.
Data Types: double
Output Arguments
Return
— Annualized internal rate of return of each cash flow stream
numeric
Annualized internal rate of return of each cash
flow stream, returned as a vector. A
NaN
indicates that a solution
was not found.
References
[1] Brealey and Myers. Principles of Corporate Finance. McGraw-Hill Higher Education, Chapter 5, 2003.
[2] Sharpe, William F., and Gordon J. Alexander. Investments. Englewood Cliffs, NJ: Prentice-Hall. 4th ed., 1990.
Version History
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)