Documentation Center

  • Trials
  • Product Updates

setBounds

Class: Portfolio

Set up bounds for portfolio weights

Syntax

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

Description

obj = setBounds(obj,LowerBound) sets up the lower bound for portfolio weights.

obj = setBounds(obj,LowerBound,UpperBound,NumAssets) sets up bounds for portfolio weights 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

Tips

Use dot notation to set up the bounds for portfolio weights.

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

Input Arguments

obj

Portfolio object [Portfolio].

LowerBound

Lower-bound weight for each asset [vector].

UpperBound

(Optional) Upper-bound weight each asset [vector].

NumAssets

(Optional) Number of assets in portfolio [scalar]. NumAssets cannot be used to change the dimension of a Portfolio object.

    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, this method switches bounds if necessary.

Output Arguments

obj

Updated Portfolio object [Portfolio].

Attributes

Accesspublic
Staticfalse
Hiddenfalse

To learn about attributes of methods, see Method Attributes in the MATLAB® Object-Oriented Programming documentation.

Examples

expand all

Set Bound Constraints

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 = Portfolio;
p = p.setBounds(lb, ub);
disp(p.NumAssets);
disp(p.LowerBound);
disp(p.UpperBound);
     2

    0.5000
    0.2500

    0.7500
    0.5000

See Also

|

More About

Was this topic helpful?