Obtain equality constraint arrays from Portfolio object
[AEquality,bEquality] = getEquality(obj)
[AEquality,bEquality] = getEquality(obj) obtains the equality constraint arrays from a Portfolio object.
You can also use dot notation to obtain the equality constraint arrays from the Portfolio object.
[AEquality, bEquality] = obj.getEquality;
Matrix to form linear equality constraints [matrix].
Vector to form linear equality constraints [vector].
To learn about attributes of methods, see Method Attributes in the MATLAB® Object-Oriented Programming documentation.
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