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 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
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
Cash flow dates, specified as a vector or matrix
using a datetime array, string array, or date character vectors. 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.
To support existing code, xirr also
accepts serial date numbers as inputs, but they are not recommended.
Data Types: char | datetime | string
(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
(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
(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
Annualized internal rate of return of each cash
flow stream, returned as a vector. A
NaN indicates that a solution
was not found.
More About
The IRR is the discount rate at which the present value of the future cash inflows equals the initial investment (cash outflows) and in the case of nonperiodic cash flows, these inflows and outflows occur at irregular intervals.
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
Introduced before R2006aAlthough xirr supports serial date numbers,
datetime values are recommended instead. The
datetime data type provides flexible date and time
formats, storage out to nanosecond precision, and properties to account for time
zones and daylight saving time.
To convert serial date numbers or text to datetime values, use the datetime function. For example:
t = datetime(738427.656845093,"ConvertFrom","datenum"); y = year(t)
y =
2021
There are no plans to remove support for serial date number inputs.
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.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- 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)