# setBounds

Set up bounds for portfolio weights for portfolio

## Syntax

## Description

sets up bounds for portfolio weights for a `obj`

= setBounds(`obj`

,`LowerBound`

)`Portfolio`

,
`PortfolioCVaR`

, or `PortfolioMAD`

object.
For details on the respective workflows when using these different objects, see
Portfolio Object Workflow, PortfolioCVaR Object Workflow,
and PortfolioMAD Object Workflow.

specifies options using one or more name-value pair arguments in addition to the
input arguments in the previous syntax, including `obj`

= setBounds(___,`Name,Value`

)`BoundType`

as `'Simple'`

or `'Conditional'`

.

sets up bounds for portfolio weights for portfolio objects with an additional
option for `obj`

= setBounds(`obj`

,`LowerBound`

,`UpperBound`

)`UpperBound`

.

Given bound constraints `LowerBound`

and
`UpperBound`

and `'Simple'`

`BoundType`

, every weight in a portfolio
`Port`

must satisfy the following:

LowerBound <= Port <= UpperBound

Given bound constraints `LowerBound`

and
`UpperBound`

, and` 'Conditional'`

`BoundType`

, every weight in a portfolio
`Port`

must satisfy the following:

Port = 0 or LowerBound <= Port <= UpperBound

specifies options using one or more name-value pair arguments in addition to the
input arguments in the previous syntax, including `obj`

= setBounds(___,`Name,Value`

)`BoundType`

as `'Simple'`

or `'Conditional'`

.

## Examples

## Input Arguments

## Output Arguments

## Tips

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

obj = obj.setBounds(LowerBound, UpperBound, Name,Value);

If any of `LowerBound`

, `UpperBound`

, or
`BoundType`

are input as empties with `[ ]`

, the
corresponding attributes in the portfolio object are cleared and set to ```
[
]
```

. If `BoundType`

is cleared as `[ ]`

,
the bound type defaults to `'Simple'`

.

p = setBounds(p, LowerBound, [ ], 'BoundType',[ ]);

To reset a portfolio object to be a continuous problem, run the following:

p = setMinMaxNumAssets(p, [],[]); p = setBounds(p, p.LowerBound, p.UpperBound, 'BoundType', 'Simple');

## Version History

**Introduced in R2011a**

## See Also

`getBounds`

| `setMinMaxNumAssets`

| `setSolverMINLP`

| `estimateAssetMoments`

| `estimateFrontier`

| `estimateFrontierByReturn`

| `estimateFrontierByRisk`

| `estimateFrontierLimits`

| `estimateMaxSharpeRatio`

| `estimatePortSharpeRatio`

| `estimatePortMoments`

| `estimatePortReturn`

| `estimatePortRisk`

### Topics

- Working with 'Simple' Bound Constraints Using Portfolio Object
- Working with 'Simple' Bound Constraints Using PortfolioCVaR Object
- Working with 'Simple' Bound Constraints Using PortfolioMAD Object
- Working with 'Conditional' BoundType, MinNumAssets, and MaxNumAssets Constraints Using Portfolio Objects
- Working with 'Conditional' BoundType, MinNumAssets, and MaxNumAssets Constraints Using PortfolioCVaR Objects
- Working with 'Conditional' BoundType, MinNumAssets, and MaxNumAssets Constraints Using PortfolioMAD Objects
- Troubleshooting for Setting 'Conditional' BoundType, MinNumAssets, and MaxNumAssets Constraints
- Portfolio Optimization Examples
- Portfolio Optimization with Semicontinuous and Cardinality Constraints
- Portfolio Set for Optimization Using Portfolio Objects
- Portfolio Set for Optimization Using PortfolioCVaR Object
- Portfolio Set for Optimization Using PortfolioMAD Object