# Documentation

### This is machine translation

Translated by
Mouse over text to see original. Click the button below to return to the English verison of the page.

# portopt

Portfolios on constrained efficient frontier

portopt has been partially removed and will no longer accept ConSet or varargin arguments. Use Portfolio instead to solve portfolio problems that are more than a long-only fully-invested portfolio. For information on the workflow when using Portfolio objects, see Portfolio Object Workflow. For more information on migrating portopt code to Portfolio, see portopt Migration to Portfolio Object.

## Syntax

[PortRisk, PortReturn, PortWts] = portopt(ExpReturn, ExpCovariance)
[PortRisk, PortReturn, PortWts] = portopt(ExpReturn, ExpCovariance,
NumPorts)
[PortRisk, PortReturn, PortWts] = portopt(ExpReturn, ExpCovariance,
NumPorts, PortReturn)

## Arguments

 ExpReturn 1 by number of assets (NASSETS) vector specifying the expected (mean) return of each asset. ExpCovariance NASSETS-by-NASSETS matrix specifying the covariance of the asset returns. NumPorts (Optional) Number of portfolios generated along the efficient frontier. Returns are equally spaced between the maximum possible return and the minimum risk point. If NumPorts is empty (entered as []), computes 10 equally spaced points. PortReturn (Optional) Expected return of each portfolio. A number of portfolios (NPORTS-by-1 vector). If not entered or empty, NumPorts equally spaced returns between the minimum and maximum possible values are used.

## Description

[PortRisk, PortReturn, PortWts] = portopt(ExpReturn, ExpCovariance) sets up the most basic portfolio problem with weights greater than or equal to 0 that must sum to 1. All that is necessary to solve this problem is the mean and covariance of asset returns. The problem returns 10 equally-spaced points on the efficient frontier by return.

[PortRisk, PortReturn, PortWts] = portopt(ExpReturn, ExpCovariance, NumPorts) sets up the basic portfolio problem but lets you specify how many equally-spaced points on the efficient frontier that you want in NumPorts. If you specify 1, it returns the minimum-risk portfolio.

[PortRisk, PortReturn, PortWts] = portopt(ExpReturn, ExpCovariance, NumPorts, PortReturn) sets up the basic portfolio problem but lets you specify target returns on the efficient frontier in the vector PortReturn. This functionality requires that if you set PortReturn, NumPorts should be empty.

 Note:   portopt generates a warning if have returns outside the range and returns the portfolios at the endpoints of the efficient frontier.

The outputs for portopt are:

PortRisk is an NPORTS-by-1 vector of the standard deviation of each portfolio.

PortReturn is an NPORTS-by-1 vector of the expected return of each portfolio.

PortWts is an NPORTS-by-NASSETS matrix of weights allocated to each asset. Each row represents a portfolio. The total of all weights in a portfolio is 1.

If portopt is invoked without output arguments, it writes to the current figure window.

## Examples

collapse all

Use portopt to connect 20 portfolios along the efficient frontier having evenly spaced returns. By default, choose among portfolios without short-selling and scale the value of the portfolio to 1.

ExpReturn = [0.1 0.2 0.15];

ExpCovariance = [0.005   -0.010    0.004
-0.010    0.040   -0.002
0.004   -0.002    0.023];

NumPorts = 20;
portopt(ExpReturn, ExpCovariance, NumPorts)