Accelerating the pace of engineering and science

# Documentation Center

• Trial Software
• Product Updates

# plotFrontier

Class: PortfolioMAD

Plot single efficient frontier for PortfolioMAD object

## Syntax

[prsk,pret] = plotFrontier(obj)
[prsk,pret] = plotFrontier(obj,varargin)

## Description

[prsk,pret] = plotFrontier(obj) plots a single efficient frontier for a PortfolioMAD object.

[prsk,pret] = plotFrontier(obj,varargin) to plot a single efficient frontier with multiple types of input methods. There are four ways to use plotFrontier:

• Method 1 — Given a PortfolioMAD object obj, estimate the efficient frontier with default number of 10 portfolios on the frontier.

`[prsk, pret] = obj.plotFrontier`
• Method 2 — Given a PortfolioMAD object obj, estimate the efficient frontier with a specified number of portfolios NumPorts on the frontier.

`[prsk, pret] = obj.plotFrontier(NumPorts)`
• Method 3 — Given a PortfolioMAD object obj with estimated efficient portfolios in PortWeights, plot the efficient frontier with those portfolios. This method assumes that you provide valid efficient portfolios as input.

`[prsk, pret] = obj.plotFrontier(PortWeights)`
• Method 4 — Given a PortfolioMAD object obj with estimated portfolio risks (PortRisk) and returns (PortReturn), plot the efficient frontier. This method assumes that you provide valid efficient portfolio risks and returns as inputs.

`[prsk, pret] = obj.plotFrontier(PortRisk, PortReturn);`
 Note:   plotFrontier handles multiple input formats as described above. Given an asset universe with NumAssets assets and an efficient frontier with NumPorts portfolios, remember that portfolio weights are NumAsset-by-NumPorts matrices and that portfolio risks and returns are NumPorts column vectors.

## Tips

Use dot notation to plot a single efficient frontier for a PortfolioMAD object.

`[prsk, pret] = obj.plotFrontier;`

## Input Arguments

 obj MAD portfolio object [PortfolioMAD]. varargin (Optional) varargin can be NumPorts, PortRisk, PortReturn, or PortWeights depending on which of the four input methods you use:Method 1 — Given a PortfolioMAD object obj, estimate the efficient frontier using the default number of 10 portfolios on the frontier:`[prsk, pret, pwgt] = obj.plotFrontier` Method 2 — Given a PortfolioMAD object obj, estimate the efficient frontier with a specified number of portfolios NumPorts on the frontier: `[prsk, pret, pwgt] = obj.plotFrontier(NumPorts)`Method 3 — Given a PortfolioMAD object obj with estimated efficient portfolios in PortWeights, plot the efficient frontier with those portfolios: `[prsk, pret, pwgt] = obj.plotFrontier(PortWeights)`This method assumes that you provide valid efficient portfolios as input.Method 4 — Given a PortfolioMAD object obj with estimated portfolio risks (PortRisk) and returns (PortReturn), plot the efficient frontier:`[prsk, pret, pwgt] = obj.plotFrontier(PortRisk, PortReturn)`This method assumes that you provide valid efficient portfolio risks and returns as inputs.

## Output Arguments

 prsk Estimated efficient portfolio risks (conditional value-at-risk) [vector].
 pret Estimated efficient portfolio returns [vector].
 Note:   If the MAD portfolio object has a name in the Name property, the name is displayed as the title of the plot. Otherwise, the plot is just labeled "Efficient Frontier."If the MAD portfolio object has an initial portfolio in the InitPort property, the initial portfolio is plotted and labeled. If portfolio risks and returns are inputs, ensure that risks come first in the calling sequence. In addition, if portfolio risks and returns are not sorted in ascending order, this method performs the sort. On output, the sorted moments are returned.

## Attributes

 Access public Static false Hidden false

To learn about attributes of methods, see Method Attributes in the MATLAB® Object-Oriented Programming documentation.

## Examples

expand all

### Plot Efficient Frontier for PortfolioMAD Object

Given a PortfolioMAD p, plot the efficient frontier.

```m = [ 0.05; 0.1; 0.12; 0.18 ];
C = [ 0.0064 0.00408 0.00192 0;
0.00408 0.0289 0.0204 0.0119;
0.00192 0.0204 0.0576 0.0336;
0 0.0119 0.0336 0.1225 ];
m = m/12;
C = C/12;

AssetScenarios = mvnrnd(m, C, 20000);

p = PortfolioMAD;
p = p.setScenarios(AssetScenarios);
p = p.setDefaultConstraints;

p.plotFrontier;
```

## More About

Was this topic helpful?