obj = setBounds(obj,LowerBound)
obj = setBounds(obj,LowerBound,UpperBound,NumAssets)
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
Use dot notation to set up the bounds for portfolio weights.
obj = obj.setBounds(LowerBound, UpperBound, NumAssets);
Portfolio object [Portfolio].
Lower-bound weight for each asset [vector].
(Optional) Upper-bound weight each asset [vector].
(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.
To learn about attributes of methods, see Method Attributes in the MATLAB® Object-Oriented Programming documentation.
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