Main Content

getInequality

Obtain inequality constraint arrays from portfolio object

Description

Use thegetInequalityfunction with aPortfolio,PortfolioCVaR, orPortfolioMADobject to obtain inequality constraint arrays from portfolio objects.

For details on the respective workflows when using these different objects, seePortfolio Object Workflow,PortfolioCVaR Object Workflow, andPortfolioMAD Object Workflow.

example

[AInequality,bInequality] = getInequality(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 no more than 50% of your portfolio. Given a Portfolio objectp, set the linear inequality constraints and then obtain values forAInequalityandbInequality.

A = [ 1 1 1 0 0 ]; b = 0.5; p = Portfolio; p = setInequality(p, A, b); [AInequality, bInequality] = getInequality(p)
AInequality =1×51 1 1 0 0
bInequality = 0.5000

Suppose you have a portfolio of five assets and you want to ensure that the first three assets constitute at most 50% of your portfolio. Given a PortfolioCVaR objectp, set the linear inequality constraints and then obtain values forAInequalityandbInequality.

A = [ 1 1 1 0 0 ]; b = 0.5; p = PortfolioCVaR; p = setInequality(p, A, b); [AInequality, bInequality] = getInequality(p)
AInequality =1×51 1 1 0 0
bInequality = 0.5000

Suppose you have a portfolio of five assets and you want to ensure that the first three assets constitute at most 50% of your portfolio. Given a PortfolioMAD objectp, set the linear inequality constraints and then obtain values forAInequalityandbInequality.

A = [ 1 1 1 0 0 ]; b = 0.5; p = PortfolioMAD; p = setInequality(p, A, b); [AInequality, bInequality] = getInequality(p)
AInequality =1×51 1 1 0 0
bInequality = 0.5000

Input Arguments

collapse all

Object for portfolio, specified usingPortfolio,PortfolioCVaR, orPortfolioMADobject. For more information on creating a portfolio object, see

Data Types:object

Output Arguments

collapse all

Matrix to form linear inequality constraints, returned as a matrix for aPortfolio,PortfolioCVaR, orPortfolioMADinput object (obj).

Vector to form linear inequality constraints, returned as a vector for aPortfolio,PortfolioCVaR, orPortfolioMADinput object (obj).

Tips

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

[AInequality, bInequality] = obj.getInequality;

Version History

Introduced in R2011a