www.gusucode.com > GAVPai_Book_MathworksCntrlFileEx_May2019 > GAVPai_Book_MathworksCntrlFileEx_May2019/weightstdzn.m
% Step 2 of Repair strategy (Chapter 4, Sec. 4.5) function std_weight_mat = weightstdzn(weight_mat, low_bounds, assetsindx) [row_mat, col_mat]=size(weight_mat); for i=1:row_mat Sum_Wgts =sum(weight_mat(i,:)); if (Sum_Wgts >1) weight_mat(i,:)= std_excesswgts(weight_mat(i,:), low_bounds, assetsindx); elseif (Sum_Wgts <1) Incr_amt = (1-Sum_Wgts)/col_mat; weight_mat(i,:)= weight_mat(i,:) +Incr_amt; else continue end end std_weight_mat=weight_mat; end