param: threat_cell - a cell array noOfOwn x noOfEnemies returns: cmp_exp - a row vector of the expected threat of each company returns: cmp_std - a row vector of the threat standard deviation of each company AUTHOR Ronnie Johansson CREATED 2004-05-31 ALTERED
0001 function [cmp_exp, cmp_std] = optfc_getCmpThreat(threat_cell) 0002 % 0003 % param: threat_cell - a cell array noOfOwn x noOfEnemies 0004 % returns: cmp_exp - a row vector of the expected threat of each company 0005 % returns: cmp_std - a row vector of the threat standard deviation of each company 0006 % 0007 % AUTHOR Ronnie Johansson 0008 % CREATED 2004-05-31 0009 % ALTERED 0010 % 0011 0012 [noOfOwnForces noOfCmps] = size(threat_cell); 0013 0014 cmp_exp = []; 0015 cmp_std = []; 0016 0017 for e=1:noOfCmps 0018 tmp_exp = []; 0019 tmp_std = []; 0020 0021 for o=1:noOfOwnForces 0022 tmp_exp = max(threat_cell{o,e}.exp); 0023 tmp_std = max(threat_cell{o,e}.std); 0024 end 0025 0026 % store the exp and std which is the maximum for all own forces 0027 cmp_exp = [cmp_exp max(tmp_exp)]; 0028 cmp_std = [cmp_std max(tmp_std)]; 0029 end 0030