%% Obtain the Portfolio for Targeted Portfolio Returns for a PortfolioMAD Object
% To obtain efficient portfolios that have targeted portfolio returns, the estimateFrontierByReturn function accepts one or more target portfolio returns and obtains efficient portfolios with the specified returns. Assume you have a universe of four assets where you want to obtain efficient portfolios with target portfolio returns of 7%, 10%, and 13%.

m = [ 0.05; 0.1; 0.12; 0.18 ];
C = [ 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 ];

rng(11);

p = PortfolioMAD;
p = simulateNormalScenariosByMoments(p, m, C, 2000);
p = setDefaultConstraints(p);

pwgt = estimateFrontierByReturn(p, [0.07 0.10, 0.13]);

display(pwgt);

% The function rng(seed) is used to reset the random number generator to produce the documented results. It is not necessary to reset the random number generator to simulate scenarios.
% Copyright 2015 The MathWorks, Inc.