how the subcarrier allocation to users in a random manner
Mostrar comentarios más antiguos
In the image given below rows represent 5 users and columns represent 20 subcarriers. each user needs to have atleast 3 or 4 subcarriers. If user one is using subcarrier 1,3,5 and 7 it should not be used by user 2,3,4 and 5. so it should be marked as 0. similar procedure needs to get repeated for all the users.
1 comentario
KSSV
el 24 de Nov. de 2017
YOu can have a look on fucntions ismember and intersect to get the common elements in different sets.
Respuestas (2)
KSSV
el 24 de Nov. de 2017
a=[ 1 12 6 25 8 30
10 9 3 20 4 9
5 2 15 7 3 6] ;
used = sort([1 5 9 2 6 3 25 20 8 3 9 6]) ;
idx = ismember(a,used) ;
iwant = zeros(size(a)) ;
iwant(~idx) = a(~idx) ;
Walter Roberson
el 24 de Nov. de 2017
carrier_list = reshape( randperm(NumberOfSubcarriers), NumberOfUsers, [])
Now each column tells you which subcarriers one user is allocated.
For the case where the number of subcarriers is not an exact multiple of the number of users, then
num_extra = mod(NumberOfSubcarriers, NumberOfUsers);
baseNumber = NumberOfSubcarriers - num_extra;
carrier_list = reshape( randperm(baseNumber), NumberOfUsers), []);
carrier_list(end+1, randperm(NumberOfUsers, num_extra) ) = baseNumber+1 : NumbeOfSubcarries;
Now each column tells you which subcarriers one user is allocated, with 0 for no subcarrier (some users may have one more subcarrier than the others; the split is as even as possible.)
Categorías
Más información sobre MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!