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.


Set up benchmark portfolio for tracking error constraint


obj = setTrackingPort(obj,TrackingPort)
obj = setTrackingPort(___,NumAssets)



obj = setTrackingPort(obj,TrackingPort) sets up a benchmark portfolio for a tracking error constraint for a Portfolio object. For details on the workflow when using a Portfolio object, see Portfolio Object Workflow.


obj = setTrackingPort(___,NumAssets) sets up a benchmark portfolio for a tracking error constraint using an optional input argument for NumAssets.


collapse all

Create a Portfolio object.

AssetMean = [ 0.05; 0.1; 0.12; 0.18 ];
AssetCovar = [ 0.0064 0.00408 0.00192 0;
    0.00408 0.0289 0.0204 0.0119;
    0.00192 0.0204 0.0576 0.0336;
    0 0.0119 0.0336 0.1225 ];

p = Portfolio('mean', AssetMean, 'covar', AssetCovar, 'lb', 0, 'budget', 1)
p = 
  Portfolio with properties:

          BuyCost: []
         SellCost: []
     RiskFreeRate: []
        AssetMean: [4x1 double]
       AssetCovar: [4x4 double]
    TrackingError: []
     TrackingPort: []
         Turnover: []
      BuyTurnover: []
     SellTurnover: []
             Name: []
        NumAssets: 4
        AssetList: []
         InitPort: []
      AInequality: []
      bInequality: []
        AEquality: []
        bEquality: []
       LowerBound: [4x1 double]
       UpperBound: []
      LowerBudget: 1
      UpperBudget: 1
      GroupMatrix: []
       LowerGroup: []
       UpperGroup: []
           GroupA: []
           GroupB: []
       LowerRatio: []
       UpperRatio: []
     MinNumAssets: []
     MaxNumAssets: []
        BoundType: []

Estimate the Sharpe ratio for the Portfolio object p and define the tracking port.

x0 = estimateMaxSharpeRatio(p);
p = setTrackingPort(p, x0);


Input Arguments

collapse all

Object for portfolio, specified using a Portfolio object. For more information on creating a portfolio object, see Portfolio.

Data Types: object

Tracking portfolio weights, specified using a vector. If TrackingPort is specified as a scalar and NumAssets exists, then TrackingPort undergoes scalar expansion.

Data Types: double

Number of assets in portfolio, specified using a scalar. If it is not possible to obtain a value for NumAssets, it is assumed that NumAssets is 1.

Data Types: double

Output Arguments

collapse all

Updated portfolio object, returned as a Portfolio object. For more information on creating a portfolio object, see Portfolio.


The tracking error constraints can be used with any of the other supported constraints in the Portfolio object without restrictions. However, since the portfolio set necessarily and sufficiently must be a non-empty compact set, the application of a tracking error constraint can result in an empty portfolio set. Use estimateBounds to confirm that the portfolio set is non-empty and compact.


You can also use dot notation to set up a benchmark portfolio for tracking error constraint.

obj = obj.setTrackingPort(TrackingPort, NumAssets);

To remove a tracking portfolio, call this function with an empty argument ([]) for TrackingPort.

obj = setTrackingPort(obj, [ ]);

Introduced in R2015b