clear all; % data for sector neutral portfolio selection problem n = 40;% number of assets k = 10;% number of sectors lambda = 1.000000e-01;% risk aversion parameter % asset mean returns mu = [... -5.724206e-03;... -5.738256e-02;... -2.066057e-02;... 3.954949e-02;... 6.380350e-02;... -3.452340e-02;... -4.097040e-03;... -4.511063e-02;... 3.559544e-02;... 8.854415e-02;... -6.551461e-02;... -1.581188e-01;... -1.900198e-01;... -6.725867e-02;... -9.943040e-02;... 1.582090e-02;... 6.838301e-02;... -5.363577e-02;... -4.637255e-02;... 2.441328e-01;... -5.528427e-02;... -5.774056e-02;... -3.624141e-02;... -1.385253e-01;... 2.113887e-01;... 4.293215e-02;... -7.668623e-02;... -1.267691e-01;... 3.765783e-03;... 1.465808e-01;... 2.710706e-02;... 6.954837e-03;... -1.363490e-01;... 1.100747e-01;... -2.595972e-01;... 7.837806e-02;... -5.963350e-02;... -9.465257e-03;... 1.992940e-01;... 1.081944e-02;... ]; % standard deviations of asset returns sigmas = [... 2.412026e-01;... 9.836163e-02;... 8.892398e-02;... 3.176707e-01;... 2.709629e-01;... 4.297720e-01;... 3.454919e-01;... 4.021115e-01;... 4.301839e-01;... 2.693837e-01;... 2.073825e-01;... 1.649149e-01;... 3.137776e-01;... 3.958668e-01;... 1.851636e-01;... 1.934122e-01;... 3.474158e-01;... 4.082042e-01;... 4.021908e-01;... 2.399173e-01;... 1.282238e-01;... 3.599238e-01;... 2.555882e-01;... 3.498137e-01;... 2.583165e-01;... 2.955634e-01;... 1.470161e-01;... 2.495283e-01;... 2.775099e-01;... 3.687146e-01;... 3.448759e-01;... 1.207333e-01;... 4.334230e-01;... 2.956466e-01;... 2.185491e-01;... 4.060458e-01;... 1.539531e-01;... 3.900593e-01;... 3.492380e-01;... 3.201460e-01;... ]; % factor loading matrix F = [... 0 4.513325e-01 0 0 0 0 0 0 0 0 -8.628490e-01 0 0 -2.130824e-01 0 0 0 -9.870088e-01 4.896617e-01 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -6.034245e-01;... -6.983963e-01 0 0 0 0 0 0 0 0 0 0 0 0 -2.609618e-01 -3.376236e-01 0 0 0 -1.018224e+00 0 0 -4.260414e-01 0 0 0 0 0 0 0 0 1.647923e+00 -1.701690e-01 1.186121e+00 0 0 0 0 -7.491083e-01 0 0;... 0 0 0 8.362688e-01 0 0 0 -1.302310e+00 0 0 9.234870e-01 -2.280104e-01 0 0 0 -1.579673e+00 0 0 0 1.350863e-01 0 0 0 -7.194333e-02 0 0 0 -5.103924e-02 0 1.286124e+00 0 1.403337e+00 5.818706e-01 0 0 0 0 0 0 0;... 1.649524e+00 0 0 0 0 0 -1.628774e+00 0 0 0 0 0 0 2.098262e+00 0 0 0 -6.024618e-02 0 0 -2.261465e+00 0 0 0 0 -3.065255e-01 0 0 0 0 0 0 0 -9.055355e-01 0 0 0 0 0 0;... 0 0 0 -2.626506e-01 0 0 0 0 0 0 0 0 0 8.142265e-01 0 0 0 0 0 0 0 4.042442e-01 0 -1.182284e+00 0 0 0 0 -1.249714e+00 3.571231e-01 0 0 0 0 0 0 0 0 0 0;... 0 0 0 0 2.333656e+00 0 0 1.356463e+00 0 0 0 0 0 -1.472593e-01 0 0 0 -8.897301e-01 1.278745e+00 0 0 0 0 0 0 0 -5.706142e-01 0 0 -1.976974e+00 1.676693e+00 6.995117e-01 0 -3.134126e-02 0 1.440315e-01 0 0 0 0;... 0 0 -1.664936e+00 0 0 0 0 0 0 0 0 0 0 0 0 1.144839e+00 3.378373e-01 0 1.821861e+00 0 0 0 0 0 1.048065e+00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;... 0 0 0 0 5.284124e-02 0 5.585971e-02 0 0 0 0 1.805302e+00 0 0 0 0 1.203747e+00 -2.717106e-01 0 0 0 0 0 0 -2.150712e+00 0 0 0 0 0 0 0 0 0 -3.022067e-01 0 0 0 0 0;... 0 0 0 0 0 0 0 0 0 0 0 0 0 9.337716e-01 0 0 0 0 0 0 6.322444e-01 0 0 0 0 0 0 1.508306e-01 0 0 1.569423e+00 0 1.411575e+00 0 0 0 0 0 0 0;... 0 0 0 0 -4.240209e-01 0 -1.161277e+00 -9.835142e-01 0 -4.623882e-01 0 0 0 0 0 0 0 9.714951e-01 0 0 0 0 0 0 0 0 0 0 0 0 0 9.088481e-01 -2.979568e-01 0 0 0 0 0 3.631312e-02 0;... ];