Quantcast

Documentation Center

  • Trial Software
  • Product Updates

setInitPort

Class: PortfolioMAD

Set up initial or current portfolio for PortfolioMAD object

Syntax

obj = setInitPort(obj,InitPort)
obj = setInitPort(obj,InitPort,NumAssets)

Description

obj = setInitPort(obj,InitPort) sets up the initial or current portfolio.

obj = setInitPort(obj,InitPort,NumAssets) sets up the initial or current portfolio with an additional options specified for NumAssets.

Tips

  • Use dot notation to set up an initial or current portfolio.

    obj = obj.setInitPort(InitPort, NumAssets);
  • To remove an initial portfolio, call this method with an empty argument [] for InitPort.

Input Arguments

obj

MAD portfolio object [PortfolioMAD].

InitPort

Initial or current portfolio weights [vector].

    Note:   If InitPort is specified as a scalar and NumAssets exists, then InitPort undergoes scalar expansion.

NumAssets

(Optional) Number of assets in MAD portfolio [scalar].

    Note:   If it is not possible to obtain a value for NumAssets, it is assumed that NumAssets is 1.

Output Arguments

obj

Updated MAD portfolio object [PortfolioMAD].

Attributes

Accesspublic
Staticfalse
Hiddenfalse

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

Examples

expand all

Set the InitPort Property

Given an initial portfolio in x0, use the setInitPort method to set the InitPort property.

p = PortfolioMAD('NumAssets', 4);
x0 = [ 0.3; 0.2; 0.2; 0.0 ];
p = p.setInitPort(x0);
disp(p.InitPort);
    0.3000
    0.2000
    0.2000
         0

Set InitPort to Create an Equally-Weighted Portfolio of Four Assets

Create an equally weighted portfolio of four assets using the setInitPort method.

p = PortfolioMAD('NumAssets', 4);
p = p.setInitPort(1/4, 4);
disp(p.InitPort);
    0.2500
    0.2500
    0.2500
    0.2500

See Also

| |

More About

Was this topic helpful?