clear allclc% S(j)= sum of sub illuminance induced by each luminaire (illuminance produced on jth location)
% m = number of luminaires
% n = number of preferred illuminance
% li(j)= largest illuminance of jth location induced only by ith luminaire i = no of luminaires, j = locations )
% Let us consider L matrix
L= [90 106 25 51 56 19 18 18 11 7 9 7; 20 91 114 17 51 59 11 18 20 6 9 9; 9 37 158 8 27 75 6 8 23 5 8 9; 79 35 9 133 42 8 47 23 6 16 8 5; 8 28 80 8 30 127 5 18 46 5 7 8; 7 18 34 7 27 95 7 27 103 5 14 34; 11 15 17 14 32 36 17 74 91 16 58 65; 6 12 18 7 19 43 7 29 124 7 28 38]x=max(L(3,:))% T=rand(1,12)
Llt=100;Ult=350;Se=Llt+(Ult-Llt).*rand(8,1)res=[];TT=[];for i=1:10000T(i,:)=rand(1,12);endfor j=1:10000Scc=L*T(j,:)';b=Scc>=Se;if b==ones(8,1)TT=[TT;T(j,:)];ff=jendendA=size(TT)mm=A(1)nn=A(2)for l=1:A(1) s(l,:)=sum(TT(l,:));endxx=min(s) % Need the row of 'TT' that gives minimum of 's'
MATLAB: Need the row of an array that gives minimum value if we sum all the elements of the row in a matrix
array sumdisplay the rowminimum sum
Best Answer