getInequality

Class: Portfolio

Obtain inequality constraint arrays from Portfolio object

Syntax

[AInequality,bInequality] = getInequality(obj)

Description

[AInequality,bInequality] = getInequality(obj) obtains the inequality constraint arrays from a Portfolio object.

Tips

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

[AInequality, bInequality] = obj.getInequality;

Input Arguments

obj

Portfolio object [Portfolio].

Output Arguments

AInequality

Matrix to form linear inequality constraints [matrix].

bInequality

Vector to form linear inequality 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 Inequality Constraints

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

Was this topic helpful?