This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

setBounds

Set up bounds for portfolio weights for PortfolioCVaR or PortfolioMAD objects

Syntax

obj = setBounds(obj,LowerBound)
obj = setBounds(obj,LowerBound,UpperBound,NumAssets)

Description

example

obj = setBounds(obj,LowerBound) sets up bounds for portfolio weights for PortfolioCVaR, or PortfolioMAD objects. For details on the respective workflows when using these different objects, see PortfolioCVaR Object Workflow and PortfolioMAD Object Workflow.

example

obj = setBounds(obj,LowerBound,UpperBound,NumAssets) sets up bounds for portfolio weights for portfolio objects with additional options for UpperBound and NumAssets.

Given bound constraints LowerBound and UpperBound, every weight in a portfolio Port must satisfy the following:

LowerBound <= Port <= UpperBound

Examples

collapse all

Suppose you have a balanced fund with stocks that can range from 50% to 75% of your portfolio and bonds that can range from 25% to 50% of your portfolio. To set the bound constraints for a balanced fund.

lb = [ 0.5; 0.25 ];
ub = [ 0.75; 0.5 ];

p = PortfolioCVaR;
p = setBounds(p, lb, ub);
disp(p.NumAssets);
     2
disp(p.LowerBound);
    0.5000
    0.2500
disp(p.UpperBound);
    0.7500
    0.5000

Suppose you have a balanced fund with stocks that can range from 50% to 75% of your portfolio and bonds that can range from 25% to 50% of your portfolio. To set the bound constraints for a balanced fund.

lb = [ 0.5; 0.25 ];
ub = [ 0.75; 0.5 ];

p = PortfolioMAD;
p = setBounds(p, lb, ub);
disp(p.NumAssets);
     2
disp(p.LowerBound);
    0.5000
    0.2500
disp(p.UpperBound);
    0.7500
    0.5000

Input Arguments

collapse all

Object for portfolio, specified using PortfolioCVaR or PortfolioMAD object. For more information on creating a portfolio object, see

Data Types: object

Lower-bound weight for each asset, specified as a vector for a PortfolioCVaR or PortfolioMAD input object (obj).

Note

  • If either LowerBound or UpperBound are input as empties with [], the corresponding attributes in the portfolio object are cleared and set to [].

  • If LowerBound or UpperBound are specified as scalars and NumAssets exists or can be imputed, then they undergo scalar expansion. The default value for NumAssets is 1.

  • If both LowerBound and UpperBound exist and they are not ordered correctly, the setBounds function switches bounds if necessary.

Data Types: double

Upper-bound weight for each asset, specified as a vector for a PortfolioCVaR or PortfolioMAD input object (obj).

Note

  • If either LowerBound or UpperBound are input as empties with [], the corresponding attributes in the portfolio object are cleared and set to [].

  • If LowerBound or UpperBound are specified as scalars and NumAssets exists or can be imputed, then they undergo scalar expansion. The default value for NumAssets is 1.

  • If both LowerBound and UpperBound exist and they are not ordered correctly, the setBounds function switches bounds if necessary.

Data Types: double

Number of assets in portfolio, specified as a scalar for a PortfolioCVaR or PortfolioMAD input object (obj).

Note

NumAssets cannot be used to change the dimension of a portfolio object.

  • If either LowerBound or UpperBound are input as empties with [], the corresponding attributes in the portfolio object are cleared and set to [].

  • If LowerBound or UpperBound are specified as scalars and NumAssets exists or can be imputed, then they undergo scalar expansion. The default value for NumAssets is 1.

  • If both LowerBound and UpperBound exist and they are not ordered correctly, the setBounds function switches bounds if necessary.

Data Types: double

Output Arguments

collapse all

Updated portfolio object, returned as a PortfolioCVaR or PortfolioMAD object. For more information on creating a portfolio object, see

Tips

You can also use dot notation to set up the bounds for portfolio weights.

 	obj = obj.setBounds(LowerBound, UpperBound, NumAssets);

Introduced in R2011a