getEquality

Class: Portfolio

Obtain equality constraint arrays from Portfolio object

Syntax

[AEquality,bEquality] = getEquality(obj)

Description

[AEquality,bEquality] = getEquality(obj) obtains the equality constraint arrays from a Portfolio object.

Tips

You can also use dot notation to obtain the equality constraint arrays from the Portfolio object.

[AEquality, bEquality] = obj.getEquality;

Input Arguments

obj

Portfolio object [Portfolio].

Output Arguments

AEquality

Matrix to form linear equality constraints [matrix].

bEquality

Vector to form linear equality constraints [vector].

Attributes

Accesspublic
Staticfalse
Hiddenfalse

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

Examples

expand all

Obtain Equality Constraints

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

Was this topic helpful?