%% Display Uplink PRB Allocation Type 1
% Display the PRB allocations associated with the sequence of subframes in a frame for DCI Format 0 and uplink resource allocation type 1.
% Configure a type 1 uplink resource allocation (multi-cluster). TS 36.213, Section 8.1.2 describes the resource indication value (RIV) determination.

enbue = struct('NDLRB',50);
dcistr = lteDCI(enbue,struct('DCIFormat','Format0','AllocationType',1));
dcistr.Allocation.RIV = 1;

% Display an image of the PRBs used in each slot of each subframe in a frame.
% Create a subframeslots matrix full of zeros. There are 20 slots per frame, specifically two slots per subframe and ten subframes per frame.
%
% Loop through assigning a PRB set of indices for each subframe. Also assign a value in subframeslots for each occupied PRB index.

subframeslots = zeros(enbue.NDLRB,20);
for i = 0:9
    enbue.NSubframe = i;
    prbSet = lteDCIResourceAllocation(enbue,dcistr);
    prbSet = repmat(prbSet,1,2/size(prbSet,2));
    for s = 1:2
        subframeslots(prbSet(:,s)+1,2*i+s) = 20+s*20;
    end
end
imagesc(subframeslots); 
axis xy;
xlabel('Subframe Slots'); 
ylabel('PRB Indices');

% Observe from the image that the same set of PRB indices is used in each slot.
% Copyright 2012 The MathWorks, Inc.