MatLab Toolbox - 5G/NR : SRS                   Home : www.sharetechnote.com

 

 

 

 SRS(Sounding Reference Signal)

 

NOTE :  It is required to have Matlab 5G Toolbox  to run this script. Matlab Version that I used for this page is 5G Toolbox  Version 2.0 (R2020a)

 

 

 

 

SRS.m

carrier = nrCarrierConfig;

srs = nrSRSConfig;

 

carrier.SubcarrierSpacing = 120;

carrier.NSizeGrid = 66;

 

srs.NumSRSPorts = 2;

srs.NumSRSSymbols = 2;

 

srs.SymbolStart = 8;

srs.KTC = 2;    % see here for the details

srs.CSRS = 3;  % see here for the details

srs.BSRS = 0;  % see here for the details

srs.BHop = 0;  % see here for the details

srs.NRRC = 0;

 

srsSym = nrSRS(carrier,srs);

srsInd = nrSRSIndices(carrier,srs);

 

K = carrier.NSizeGrid*12;       % Number of subcarriers

L = carrier.SymbolsPerSlot;    % Number of OFDM symbols per slot

P = srs.NumSRSPorts;           % Number of antenna ports

gridSize = [K L P];

 

slotGrid = complex(zeros(gridSize));

 

slotGrid(srsInd) = srsSym;

 

% Display the resource grid plot in a new figure

cmap = parula(64);

%figure('Name','Resource Grid');

hFig = figure(1);

set(hFig, 'Position', [100 100 800 600]);

set(gcf,'color','w');

 

% SRS port 0 --------------------------------------------------------

subplot(2,2,[1 3]);

hold on;

image(40*abs(slotGrid(:,:,1)));

axis(gca,'xy');

colormap(cmap);

 

for i = 2:14

  line([i-0.5 i-0.5],[0 273*12],'Color','white');

end

xlim([0.5 14.5]);

ylim([0 carrier.NSizeGrid*12]);

 

set(gca,'xtick',[0:14]);

set(gca,'xticklabel',{'','0','1','2','3','4','5','6','7','8','9','10','11','12','13'});

set(gca,'ytick',[1 carrier.NSizeGrid*12]);

set(gca,'yticklabel',{'0',num2str(carrier.NSizeGrid-1)});

ylabel("RB");

tmpStr = sprintf("Full RB - port 0\nKTC=%d,CSRS=%d,BSRS=%d,BHop=%d",srs.KTC,srs.CSRS,srs.BSRS,srs.BHop);

title(tmpStr);

hold off;

 

subplot(2,2,2);

hold on;

image(40*abs(slotGrid(:,:,1)));

axis(gca,'xy');

colormap(cmap);

 

for i = 2:14

  line([i-0.5 i-0.5],[0 273*12],'Color','white');

end

for j = 1:12

  line([0 15],[j+0.5 j+0.5],'Color','white');

end

xlim([0.5 14.5]);

ylim([0.5 12.5]);

set(gca,'xtick',[0:14]);

set(gca,'xticklabel',{'','0','1','2','3','4','5','6','7','8','9','10','11','12','13'});

set(gca,'ytick',[0:12]);

set(gca,'yticklabel',{'','0','1','2','3','4','5','6','7','8','9','10','11'});

ylabel("subcarrier");

title('First RB - port 0');

hold off;

   

 

% SRS port 1 --------------------------------------------------------

 

subplot(2,2,4);

hold on;

image(40*abs(slotGrid(:,:,2)));

axis(gca,'xy');

colormap(cmap);

 

for i = 2:14

  line([i-0.5 i-0.5],[0 273*12],'Color','white');

end

for j = 1:12

  line([0 15],[j+0.5 j+0.5],'Color','white');

end

xlim([0.5 14.5]);

ylim([0.5 12.5]);

set(gca,'xtick',[0:14]);

set(gca,'xticklabel',{'','0','1','2','3','4','5','6','7','8','9','10','11','12','13'});

set(gca,'ytick',[0:12]);

set(gca,'yticklabel',{'','0','1','2','3','4','5','6','7','8','9','10','11'});

ylabel("subcarrier");

title('First RB - port 1');

hold off;

 

 

Example 01>  KTC = 2, CSRS = 0, BSRS = 0,BHop = 0,NumSRSSymbols = 1, NRRC = 0

 

 

 

Example 02>  KTC = 2, CSRS = 1, BSRS = 0,BHop = 0,NumSRSSymbols = 1, NRRC = 0

 

 

 

Example 03>  KTC = 2, CSRS = 2, BSRS = 0,BHop = 0,NumSRSSymbols = 1, NRRC = 0

 

 

 

Example 04>  KTC = 2, CSRS = 3, BSRS = 0,BHop = 0,NumSRSSymbols = 1, NRRC = 0

 

 

 

Example 05>  KTC = 2, CSRS = 4, BSRS = 0,BHop = 0,NumSRSSymbols = 1, NRRC = 0

 

 

 

Example 06>  KTC = 2, CSRS = 5, BSRS = 0,BHop = 0,NumSRSSymbols = 1, NRRC = 0

 

 

 

Example 07>  KTC = 2, CSRS = 6, BSRS = 0,BHop = 0,NumSRSSymbols = 1, NRRC = 0

 

 

 

Example 08>  KTC = 2, CSRS = 7, BSRS = 0,BHop = 0,NumSRSSymbols = 1, NRRC = 0

 

 

 

Example 09>  KTC = 2, CSRS = 8, BSRS = 0,BHop = 0,NumSRSSymbols = 1, NRRC = 0

 

 

 

Example 10>  KTC = 2, CSRS = 9, BSRS = 0,BHop = 0,NumSRSSymbols = 1, NRRC = 0

 

 

 

Example 11>  KTC = 2, CSRS = 10, BSRS = 0,BHop = 0,NumSRSSymbols = 1, NRRC = 0

 

 

 

Example 12>  KTC = 2, CSRS = 11, BSRS = 0,BHop = 0,NumSRSSymbols = 1, NRRC = 0

 

 

 

Example 13>  KTC = 2, CSRS = 12, BSRS = 0,BHop = 0,NumSRSSymbols = 1, NRRC = 0

 

 

 

Example 14>  KTC = 2, CSRS = 13, BSRS = 0,BHop = 0,NumSRSSymbols = 1, NRRC = 0

 

 

 

Example 15>  KTC = 2, CSRS = 14, BSRS = 0,BHop = 0,NumSRSSymbols = 1, NRRC = 0

 

 

 

Example 16>  KTC = 2, CSRS = 15, BSRS = 0,BHop = 0,NumSRSSymbols = 1, NRRC = 0

 

 

 

Example 17>  KTC = 2, CSRS = 16, BSRS = 0,BHop = 0,NumSRSSymbols = 1, NRRC = 0

 

 

 

Example 18>  KTC = 2, CSRS = 17, BSRS = 0,BHop = 0,NumSRSSymbols = 1, NRRC = 0

 

 

 

Example 19>  KTC = 2, CSRS = 17, BSRS = 0,BHop = 0,NumSRSSymbols = 2, NRRC = 0

 

 

 

Example 20>  KTC = 2, CSRS = 17, BSRS = 0,BHop = 0,NumSRSSymbols = 4, NRRC = 0

 

 

 

Example 21>  KTC = 4, CSRS = 17, BSRS = 0,BHop = 0,NumSRSSymbols = 4, NRRC = 0

 

 

 

Example 22>  KTC = 2, CSRS = 17, BSRS = 1,BHop = 0,NumSRSSymbols = 1, NRRC = 0

 

 

 

Example 23>  KTC = 2, CSRS = 17, BSRS = 2,BHop = 0,NumSRSSymbols = 1, NRRC = 0

 

 

 

Example 24>  KTC = 2, CSRS = 17, BSRS = 3,BHop = 0,NumSRSSymbols = 1, NRRC = 0

 

 

 

Example 25>  KTC = 2, CSRS = 17, BSRS = 1,BHop = 0,NumSRSSymbols = 2, NRRC = 0

 

 

 

Example 26>  KTC = 2, CSRS = 17, BSRS = 2,BHop = 0,NumSRSSymbols = 2, NRRC = 0

 

 

 

Example 27>  KTC = 2, CSRS = 17, BSRS = 3,BHop = 0,NumSRSSymbols = 2, NRRC = 0

 

 

 

Example 28>  KTC = 2, CSRS = 17, BSRS = 1,BHop = 0,NumSRSSymbols = 2, NRRC = 0

 

 

 

Example 29>  KTC = 2, CSRS = 17, BSRS = 2,BHop = 0,NumSRSSymbols = 4, NRRC = 0

 

 

 

Example 30>  KTC = 2, CSRS = 17, BSRS = 3,BHop = 0,NumSRSSymbols = 4, NRRC = 0

 

 

 

Example 31>  KTC = 2, CSRS = 13, BSRS = 3,BHop = 1,NumSRSSymbols = 2, NRRC = 0

 

 

 

Example 32>  KTC = 2, CSRS = 13, BSRS = 3,BHop = 2,NumSRSSymbols = 2, NRRC = 0

 

 

 

Example 33>  KTC = 2, CSRS = 13, BSRS = 3,BHop = 3,NumSRSSymbols = 2, NRRC = 0

 

 

 

Example 34>  KTC = 2, CSRS = 13, BSRS = 3,BHop = 1,NumSRSSymbols = 4, NRRC = 0

 

 

 

Example 35>  KTC = 2, CSRS = 13, BSRS = 3,BHop = 2,NumSRSSymbols = 4, NRRC = 0

 

 

 

Example 36>  KTC = 2, CSRS = 13, BSRS = 3,BHop = 3,NumSRSSymbols = 4, NRRC = 0

 

 

 

Example 37>  KTC = 2, CSRS = 13, BSRS = 3,BHop = 1,NumSRSSymbols = 4, NRRC = 0

 

 

 

Example 38>  KTC = 2, CSRS = 13, BSRS = 3,BHop = 1,NumSRSSymbols = 4, NRRC = 1

 

 

 

Example 39>  KTC = 2, CSRS = 13, BSRS = 3,BHop = 1,NumSRSSymbols = 4, NRRC = 2

 

 

 

Example 40>  KTC = 2, CSRS = 13, BSRS = 3,BHop = 1,NumSRSSymbols = 4, NRRC = 3

 

 

 

Example 41>  KTC = 2, CSRS = 13, BSRS = 3,BHop = 1,NumSRSSymbols = 4, NRRC = 4

 

 

 

Example 42>  KTC = 2, CSRS = 13, BSRS = 3,BHop = 1,NumSRSSymbols = 4, NRRC = 5

 

 

 

Example 43>  KTC = 2, CSRS = 13, BSRS = 3,BHop = 1,NumSRSSymbols = 4, NRRC = 6

 

 

 

Example 44>  KTC = 2, CSRS = 13, BSRS = 3,BHop = 1,NumSRSSymbols = 4, NRRC = 7

 

 

 

Example 45>  KTC = 2, CSRS = 13, BSRS = 3,BHop = 1,NumSRSSymbols = 4, NRRC = 8

 

 

 

Example 46>  KTC = 2, CSRS = 13, BSRS = 3,BHop = 1,NumSRSSymbols = 4, NRRC = 9

 

 

 

Example 47>  KTC = 2, CSRS = 13, BSRS = 3,BHop = 1,NumSRSSymbols = 4, NRRC = 10

 

 

 

Example 48>  KTC = 2, CSRS = 13, BSRS = 3,BHop = 1,NumSRSSymbols = 4, NRRC = 11

 

 

 

Example 49>  KTC = 2, CSRS = 13, BSRS = 3,BHop = 1,NumSRSSymbols = 4, NRRC = 12

 

 

 

Example 43>  KTC = 2, CSRS = 13, BSRS = 3,BHop = 1,NumSRSSymbols = 4, NRRC = 6