Obtain inequality constraint arrays from Portfolio object
[AInequality,bInequality] = getInequality(obj)
[AInequality,bInequality] = getInequality(obj) obtains the inequality constraint arrays from a Portfolio object.
You can also use dot notation to obtain the inequality constraint arrays from the Portfolio object.
[AInequality, bInequality] = obj.getInequality;
Matrix to form linear inequality constraints [matrix].
Vector to form linear inequality 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 no more than 50% of your portfolio. Given a Portfolio object p, set the linear inequality constraints and then obtain values for AInequality and bInequality.
A = [ 1 1 1 0 0 ]; b = 0.5; p = Portfolio; p = setInequality(p, A, b); [AInequality, bInequality] = getInequality(p)
AInequality = 1 1 1 0 0 bInequality = 0.5000