How can I simulate a resource allocation?
    3 views (last 30 days)
  
       Show older comments
    
    giancarlo maldonado cardenas
 on 10 Nov 2021
  
    
    
    
    
    Commented: giancarlo maldonado cardenas
 on 10 Nov 2021
            Hi, I need help with creating code.
*************************************************
attached file
detected = vector of detected preambles.
the value of this vector is random, sometimes it can have 1 or ....... N values.
*************************************************
for example I have 50 resources available and I need to assign those resources to the detected preambles that would be the attached file (detected).
for example if I have 50 PRBs and I have 12 preambles in (detected) the algorithm would have to run only 12 times.
and if for example I had 10 PRBs and I have 12 preambles in (detected) the algorithm would only have to run 10 times, because there would be no more resources to allocate.
Thank you very much in advance
0 Comments
Answers (1)
  Sulaymon Eshkabilov
      
 on 10 Nov 2021
        According to what you have stated in your exercise description and understood, this code can be written:
D = load('detected.mat');
if numel(PRBs)==50 && numel(D)>12
for ii=1:12
    N(ii)=PRB(D(ii));
end
elseif numel(PRBs)==50 && numel(D)==12
for ii=1:12
    N(ii)=PRB(D(ii));
end
else % numel(PRBs)==10 && numel(D)==12
    for ii=1:10
    N(ii)=PRB(D(ii));
    end
end
See Also
Categories
				Find more on LTE Toolbox in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
