Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

getEquality

Obtain equality constraint arrays from portfolio object

Use the getEquality function with a Portfolio, PortfolioCVaR, or PortfolioMAD object to obtain equality constraint arrays from portfolio objects.

For details on the respective workflows when using these different objects, see Portfolio Object Workflow, PortfolioCVaR Object Workflow, and PortfolioMAD Object Workflow.

Syntax

[AEquality,bEquality] = getEquality(obj)

Description

example

[AEquality,bEquality] = getEquality(obj) obtains equality constraint arrays from portfolio objects.

Examples

collapse all

Suppose you have a portfolio of five assets and you want to ensure that the first three assets are exactly 50% of your portfolio. Given a Portfolio object p, set the linear equality constraints and obtain the values for AEquality and bEquality:

A = [ 1 1 1 0 0 ];
b = 0.5;
p = Portfolio;
p = setEquality(p, A, b);
[AEquality, bEquality] = getEquality(p)
AEquality = 

     1     1     1     0     0

bEquality = 0.5000

Suppose you have a portfolio of five assets and you want to ensure that the first three assets are 50% of your portfolio. Given a PortfolioCVaR object p, set the linear equality constraints and obtain the values for AEquality and bEquality:

A = [ 1 1 1 0 0 ];
b = 0.5;
p = PortfolioCVaR;
p = setEquality(p, A, b);
[AEquality, bEquality] = getEquality(p)
AEquality = 

     1     1     1     0     0

bEquality = 0.5000

Suppose you have a portfolio of five assets and you want to ensure that the first three assets are 50% of your portfolio. Given a PortfolioMAD object p, set the linear equality constraints and obtain the values for AEquality and bEquality:

A = [ 1 1 1 0 0 ];
b = 0.5;
p = PortfolioMAD;
p = setEquality(p, A, b);
[AEquality, bEquality] = getEquality(p)
AEquality = 

     1     1     1     0     0

bEquality = 0.5000

Input Arguments

collapse all

Object for portfolio, specified using Portfolio, PortfolioCVaR, or PortfolioMAD object. For more information on creating a portfolio object, see

Output Arguments

collapse all

Matrix to form linear equality constraints, returned as a matrix for a Portfolio, PortfolioCVaR, or PortfolioMAD input object (obj).

Vector to form linear equality constraints, returned as a vector for a Portfolio, PortfolioCVaR, or PortfolioMAD input object (obj).

Tips

You can also use dot notation to obtain the equality constraint arrays from portfolio objects.

[AEquality, bEquality] = obj.getEquality;

Introduced in R2011a

Was this topic helpful?