%% Simulate Multivariate Normal Asset Return Scenarios from Moments for a PortfolioCVaR Object
% Given PortfolioCVaR object p, use the simulateNormalScenariosByMoments function to simulate multivariate normal asset return scenarios from moments.

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 ];
m = m/12;
C = C/12;

AssetScenarios = mvnrnd(m, C, 20000);

p = PortfolioCVaR;
p = setScenarios(p, AssetScenarios);
p = setDefaultConstraints(p);
p = setProbabilityLevel(p, 0.95);

AssetMean = [.5]
AssetCovar = [.5]
NumScenarios = 100

p = simulateNormalScenariosByMoments(p, AssetMean, AssetCovar, NumScenarios)

% Copyright 2015 The MathWorks, Inc.