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

 

 

 

PDSCH/DMRS 

 

 

NOTE :  It is required to have Matlab 5G Toolbox  option to run this script

 

Following code is based on '3GPP 5G NR PDSCH Throughput Simulation' in Matlab 5G Library help document. I've revised the code just a little bit for my own purpose.

PDSCH_DMRS.m

gNB.NDLRB = 20;               

gNB.SubcarrierSpacing = 30;    % 15, 30, 60, 120, 240, 480 (kHz)

gNB.WaveformType = 'CP-OFDM';  % 'CP-OFDM', 'W-OFDM' or 'F-OFDM'

gNB.CyclicPrefix = 'Normal';   % 'Normal' or 'Extended'

gNB.UseDCSubcarrier = 'On';    % 'On' or 'Off'

gNB.NCellID = 1;               % Cell identity

 

% DL-SCH/PDSCH parameters ----------------------------------------

gNB.PDSCH.TargetCodeRate = 0.5;    % Code rate used to calculate transport block sizes

gNB.PDSCH.CodingType = 'LDPC';     % Set to 'LDPC' for 5G DL-SCH or 'Turbo' for LTE DL-SCH

gNB.PDSCH.PRBSet = 0:0;            % PDSCH PRB allocation

gNB.PDSCH.SymbolSet = 0:13;        % PDSCH symbol allocation in slot

gNB.PDSCH.Modulation = '16QAM';    % 'QPSK', '16QAM', '64QAM', '256QAM'

gNB.PDSCH.NLayers = 2;             % Number of PDSCH layers

gNB.PDSCH.NTxAnts = 8;             % Number of PDSCH transmission antennas

gNB.PDSCH.EnableHARQ = true;       % Enable/disable HARQ, if disabled, single transmission with

                                   % RV=0, i.e. no retransmissions

 

% DM-RS configuration (TS 38.211 section 7.4.1.1) ---------------------

gNB.PDSCH.PortSet = [0,2];         % DM-RS ports to use for the layers

gNB.PDSCH.PDSCHMappingType = 'A';  % PDSCH mapping type ('A'(slot-wise),'B'(non slot-wise))

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   % Mapping type A only. First DM-RS symbol position (2,3)

gNB.PDSCH.DL_DMRS_max_len = 1;     % Number of front-loaded DM-RS symbols

                                   % (1(single symbol),2(double symbol))

gNB.PDSCH.DL_DMRS_add_pos = 0;     % Additional DM-RS symbol positions (max range 0...3)

gNB.PDSCH.DL_DMRS_config_type = 2; % DM-RS configuration type (1,2)

gNB.PDSCH.NIDNSCID = 1;            % Scrambling identity (0...65535)

gNB.PDSCH.NSCID = 0;               % Scrambling initialization (0,1)

 

% SS burst configuration -------------------------------------------

gNB.SSBurst.BurstType = 'CaseB';        % 30kHz subcarrier spacing

gNB.SSBurst.SSBTransmitted = [0 0 0 0 0 0 0 0]; % Bitmap indicating blocks transmitted

                                                % in the burst. I disabled all SSB transmission

                                                % just to simplify the PDSCH/DMRS resource mapping

gNB.SSBurst.SSBPeriodicity = 10;    % SS burst set periodicity in ms (5, 10, 20, 40, 80, 160)

gNB.SSBurst.SubcarrierOffset = 0;   % SSB location in frequency domain

 

 

pdsch = gNB.PDSCH;

 

% Create SS burst waveform and information structure and display a plot -------------------

ssburst = gNB.SSBurst;

ssburst.DisplayBurst = false;

[ssbWaveform,~,ssbInfo] = h5gSSBurst(gNB,ssburst);

 

 

% Demodulate SS burst waveform using data numerology - note that depending

% on subcarrier spacings, the SS burst content may not be orthogonal with

% the data subcarriers

ssbGrid = h5gOFDMDemodulate(gNB,ssbWaveform);

 

waveformInfo = h5gOFDMInfo(gNB);

grid = zeros(waveformInfo.NSubcarriers,waveformInfo.SymbolsPerSlot,pdsch.NLayers);

 

% Create PDSCH and PDSCH DM-RS indices

[pdschIndices,pdschDmrsIndices,dmrsSymbols] = h5gPDSCHResources(gNB,pdsch);

 

% this is just to print out dmrs symbol and dmrs location (RE index)

pdschDmrsIndices

dmrsSymbols

    

% Mark PDSCH and PDSCH DM-RS positions in the grid

grid(pdschIndices) = 2;

grid(pdschDmrsIndices) = 3;

 

% Mark SS burst positions in the grid

grid(abs(ssbGrid)>=0.5) = grid(abs(ssbGrid)>=0.5) + 1;

grid(abs(ssbGrid)<0.5 & abs(ssbGrid)>=0.1) = grid(abs(ssbGrid)<0.5 & abs(ssbGrid)>=0.1) + 0.3;

grid(abs(ssbGrid)<0.1 & abs(ssbGrid)>0.03) = grid(abs(ssbGrid)<0.1 & abs(ssbGrid)>0.03) + 0.1;

 

 

% Plot DMRS in the full grid and magnified (PDSCH/DMRS only) grid

subplot(2,2,1);

imagesc(abs(grid(:,:,1)));

axis xy;

set(gca,'xticklabel',{'1','3','5','7','9','11','13'});

 

% Create a legend for the different channels / signals, this is

% achieved by drawing off-plot patches with the appropriate colors

% then adding a legend

hold on;

patch([-2 -3 -3 -2],[-2 -2 -3 -3],1);

patch([-2 -3 -3 -2],[-2 -2 -3 -3],2);

patch([-2 -3 -3 -2],[-2 -2 -3 -3],3);

legend('SS burst','PDSCH','PDSCH DM-RS');

    

% Add axis labels and title

ylabel('Subcarriers');

xlabel('OFDM symbols');

title(sprintf('Resource Grid Layer 0 \n SCS=%dkHz, NDLRB=%d, Port=%d',...

              gNB.SubcarrierSpacing,gNB.NDLRB,1000 + pdsch.PortSet(1)));    

 

subplot(2,2,2);

imagesc(abs(grid(:,:,1)));

axis xy;

ylim([pdsch.PRBSet(1) pdsch.PRBSet(end)+1]*12);

set(gca,'xtick',1:14);

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

title('PDSCH/DMRS Only');

 

subplot(2,2,3);

imagesc(abs(grid(:,:,2)));

axis xy;

set(gca,'xticklabel',{'1','3','5','7','9','11','13'});

     

% Create a legend for the different channels / signals, this is

% achieved by drawing off-plot patches with the appropriate colors

% then adding a legend

hold on;

patch([-2 -3 -3 -2],[-2 -2 -3 -3],1);

patch([-2 -3 -3 -2],[-2 -2 -3 -3],2);

patch([-2 -3 -3 -2],[-2 -2 -3 -3],3);

legend('SS burst','PDSCH','PDSCH DM-RS');

    

% Add axis labels and title

ylabel('Subcarriers');

xlabel('OFDM symbols');

title(sprintf('Resource Grid Layer 1 \n SCS=%dkHz, NDLRB=%d, Port=%d',...

              gNB.SubcarrierSpacing,gNB.NDLRB,1000 + pdsch.PortSet(1)));    

 

    

subplot(2,2,4);

imagesc(abs(grid(:,:,2)));

axis xy;

ylim([pdsch.PRBSet(1) pdsch.PRBSet(end)+1]*12);

set(gca,'xtick',1:14);

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

title('PDSCH/DMRS Only');

 

drawnow;

    

set(gcf, 'Position', [200, 200, 700, 700])

 

 

 

< Case 1 > gNB.PDSCH.NLayers = 1; gNB.PDSCH.PortSet = [0];

 

gNB.PDSCH.NLayers = 1

gNB.PDSCH.PortSet = [0];         

gNB.PDSCH.PDSCHMappingType = 'A';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   

gNB.PDSCH.DL_DMRS_max_len = 1;     

gNB.PDSCH.DL_DMRS_add_pos = 0;     

gNB.PDSCH.DL_DMRS_config_type = 2;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

   481

   482

   487

   488

 

 

dmrsSymbols =

 

   0.7071 + 0.7071i

   0.7071 + 0.7071i

  -0.7071 - 0.7071i

  -0.7071 + 0.7071i

 

 

 

gNB.PDSCH.NLayers = 1

gNB.PDSCH.PortSet = [0];         

gNB.PDSCH.PDSCHMappingType = 'A';  

gNB.PDSCH.DL_DMRS_typeA_pos = 3;   

gNB.PDSCH.DL_DMRS_max_len = 1;     

gNB.PDSCH.DL_DMRS_add_pos = 0;     

gNB.PDSCH.DL_DMRS_config_type = 2;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

   721

   722

   727

   728

 

 

dmrsSymbols =

 

  -0.7071 - 0.7071i

   0.7071 - 0.7071i

  -0.7071 + 0.7071i

  -0.7071 - 0.7071i

 

 

 

gNB.PDSCH.NLayers = 1

gNB.PDSCH.PortSet = [0];

gNB.PDSCH.PDSCHMappingType = 'A';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   

gNB.PDSCH.DL_DMRS_max_len = 2;     

gNB.PDSCH.DL_DMRS_add_pos = 0;     

gNB.PDSCH.DL_DMRS_config_type = 2;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

   481

   482

   487

   488

   721

   722

   727

   728

 

 

dmrsSymbols =

 

   0.7071 + 0.7071i

   0.7071 + 0.7071i

  -0.7071 - 0.7071i

  -0.7071 + 0.7071i

  -0.7071 - 0.7071i

   0.7071 - 0.7071i

  -0.7071 + 0.7071i

  -0.7071 - 0.7071i

 

 

 

gNB.PDSCH.NLayers = 1

gNB.PDSCH.PortSet = [0];          

gNB.PDSCH.PDSCHMappingType = 'A';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   

gNB.PDSCH.DL_DMRS_max_len = 1;     

gNB.PDSCH.DL_DMRS_add_pos = 1;     

gNB.PDSCH.DL_DMRS_config_type = 2;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

         481

         482

         487

         488

        2641

        2642

        2647

        2648

 

 

dmrsSymbols =

 

   0.7071 + 0.7071i

   0.7071 + 0.7071i

  -0.7071 - 0.7071i

  -0.7071 + 0.7071i

   0.7071 + 0.7071i

  -0.7071 + 0.7071i

   0.7071 + 0.7071i

   0.7071 - 0.7071i

 

 

 

gNB.PDSCH.NLayers = 1

gNB.PDSCH.PortSet = [0];         

gNB.PDSCH.PDSCHMappingType = 'A';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   

gNB.PDSCH.DL_DMRS_max_len = 1;     

gNB.PDSCH.DL_DMRS_add_pos = 2;     

gNB.PDSCH.DL_DMRS_config_type = 2;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

         481

         482

         487

         488

        1681

        1682

        1687

        1688

        2641

        2642

        2647

        2648

 

 

dmrsSymbols =

 

   0.7071 + 0.7071i

   0.7071 + 0.7071i

  -0.7071 - 0.7071i

  -0.7071 + 0.7071i

   0.7071 + 0.7071i

  -0.7071 + 0.7071i

  -0.7071 - 0.7071i

  -0.7071 + 0.7071i

   0.7071 + 0.7071i

  -0.7071 + 0.7071i

   0.7071 + 0.7071i

   0.7071 - 0.7071i

 

 

 

gNB.PDSCH.NLayers = 1

gNB.PDSCH.PortSet = [0];         

gNB.PDSCH.PDSCHMappingType = 'A';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   

gNB.PDSCH.DL_DMRS_max_len = 1;     

gNB.PDSCH.DL_DMRS_add_pos = 3;     

gNB.PDSCH.DL_DMRS_config_type = 2;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

         481

         482

         487

         488

        1201

        1202

        1207

        1208

        1921

        1922

        1927

        1928

        2641

        2642

        2647

        2648

 

 

dmrsSymbols =

 

   0.7071 + 0.7071i

   0.7071 + 0.7071i

  -0.7071 - 0.7071i

  -0.7071 + 0.7071i

  -0.7071 - 0.7071i

   0.7071 + 0.7071i

   0.7071 - 0.7071i

   0.7071 + 0.7071i

   0.7071 - 0.7071i

   0.7071 + 0.7071i

  -0.7071 + 0.7071i

   0.7071 + 0.7071i

   0.7071 + 0.7071i

  -0.7071 + 0.7071i

   0.7071 + 0.7071i

   0.7071 - 0.7071i

 

 

 

gNB.PDSCH.NLayers = 1

gNB.PDSCH.PortSet = [0];         

gNB.PDSCH.PDSCHMappingType = 'A';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   

gNB.PDSCH.DL_DMRS_max_len = 1;     

gNB.PDSCH.DL_DMRS_add_pos = 0;     

gNB.PDSCH.DL_DMRS_config_type = 1;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

   481

   483

   485

   487

   489

   491

 

 

dmrsSymbols =

 

   0.7071 + 0.7071i

   0.7071 + 0.7071i

  -0.7071 - 0.7071i

  -0.7071 + 0.7071i

   0.7071 + 0.7071i

   0.7071 + 0.7071i

 

 

 

gNB.PDSCH.NLayers = 1

gNB.PDSCH.PortSet = [0];         

gNB.PDSCH.PDSCHMappingType = 'A';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   

gNB.PDSCH.DL_DMRS_max_len = 2;     

gNB.PDSCH.DL_DMRS_add_pos = 0;     

gNB.PDSCH.DL_DMRS_config_type = 1;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

   481

   483

   485

   487

   489

   491

   721

   723

   725

   727

   729

   731

 

 

dmrsSymbols =

 

   0.7071 + 0.7071i

   0.7071 + 0.7071i

  -0.7071 - 0.7071i

  -0.7071 + 0.7071i

   0.7071 + 0.7071i

   0.7071 + 0.7071i

  -0.7071 - 0.7071i

   0.7071 - 0.7071i

  -0.7071 + 0.7071i

  -0.7071 - 0.7071i

   0.7071 - 0.7071i

   0.7071 - 0.7071i

 

 

 

gNB.PDSCH.NLayers = 1

gNB.PDSCH.PortSet = [0];         

gNB.PDSCH.PDSCHMappingType = 'A';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   

gNB.PDSCH.DL_DMRS_max_len = 1;     

gNB.PDSCH.DL_DMRS_add_pos = 3;     

gNB.PDSCH.DL_DMRS_config_type = 1;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

         481

         483

         485

         487

         489

         491

        1201

        1203

        1205

        1207

        1209

        1211

        1921

        1923

        1925

        1927

        1929

        1931

        2641

        2643

        2645

        2647

        2649

        2651

 

 

dmrsSymbols =

 

   0.7071 + 0.7071i

   0.7071 + 0.7071i

  -0.7071 - 0.7071i

  -0.7071 + 0.7071i

   0.7071 + 0.7071i

   0.7071 + 0.7071i

  -0.7071 - 0.7071i

   0.7071 + 0.7071i

   0.7071 - 0.7071i

   0.7071 + 0.7071i

  -0.7071 + 0.7071i

  -0.7071 + 0.7071i

   0.7071 - 0.7071i

   0.7071 + 0.7071i

  -0.7071 + 0.7071i

   0.7071 + 0.7071i

   0.7071 - 0.7071i

  -0.7071 + 0.7071i

   0.7071 + 0.7071i

  -0.7071 + 0.7071i

   0.7071 + 0.7071i

   0.7071 - 0.7071i

  -0.7071 - 0.7071i

  -0.7071 - 0.7071i

 

 

 

gNB.PDSCH.NLayers = 1

gNB.PDSCH.PortSet = [1];         

gNB.PDSCH.PDSCHMappingType = 'A';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   

gNB.PDSCH.DL_DMRS_max_len = 1;     

gNB.PDSCH.DL_DMRS_add_pos = 0;     

gNB.PDSCH.DL_DMRS_config_type = 1;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

   481

   482

   487

   488

 

 

dmrsSymbols =

 

   0.7071 + 0.7071i

  -0.7071 - 0.7071i

  -0.7071 - 0.7071i

   0.7071 - 0.7071i

 

 

 

gNB.PDSCH.NLayers = 1

gNB.PDSCH.PortSet = [2];         

gNB.PDSCH.PDSCHMappingType = 'A';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   

gNB.PDSCH.DL_DMRS_max_len = 1;     

gNB.PDSCH.DL_DMRS_add_pos = 0;     

gNB.PDSCH.DL_DMRS_config_type = 1;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

   483

   484

   489

   490

 

 

dmrsSymbols =

 

   0.7071 + 0.7071i

   0.7071 + 0.7071i

  -0.7071 - 0.7071i

  -0.7071 + 0.7071i

 

 

 

gNB.PDSCH.NLayers = 1

gNB.PDSCH.PortSet = [3];         

gNB.PDSCH.PDSCHMappingType = 'A';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   

gNB.PDSCH.DL_DMRS_max_len = 1;     

gNB.PDSCH.DL_DMRS_add_pos = 0;     

gNB.PDSCH.DL_DMRS_config_type = 1;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

   483

   484

   489

   490

 

 

dmrsSymbols =

 

   0.7071 + 0.7071i

  -0.7071 - 0.7071i

  -0.7071 - 0.7071i

   0.7071 - 0.7071i

 

 

 

gNB.PDSCH.NLayers = 1

gNB.PDSCH.PortSet = [4];         

gNB.PDSCH.PDSCHMappingType = 'A';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   

gNB.PDSCH.DL_DMRS_max_len = 1;     

gNB.PDSCH.DL_DMRS_add_pos = 0;     

gNB.PDSCH.DL_DMRS_config_type = 1;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

   485

   486

   491

   492

 

 

dmrsSymbols =

 

   0.7071 + 0.7071i

   0.7071 + 0.7071i

  -0.7071 - 0.7071i

  -0.7071 + 0.7071i

 

 

 

gNB.PDSCH.NLayers = 1

gNB.PDSCH.PortSet = [5];         

gNB.PDSCH.PDSCHMappingType = 'A';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   

gNB.PDSCH.DL_DMRS_max_len = 1;     

gNB.PDSCH.DL_DMRS_add_pos = 0;     

gNB.PDSCH.DL_DMRS_config_type = 1;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

   485

   486

   491

   492

 

 

dmrsSymbols =

 

   0.7071 + 0.7071i

  -0.7071 - 0.7071i

  -0.7071 - 0.7071i

   0.7071 - 0.7071i

 

 

 

gNB.PDSCH.NLayers = 1

gNB.PDSCH.PortSet = [6];         

gNB.PDSCH.PDSCHMappingType = 'A';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   

gNB.PDSCH.DL_DMRS_max_len = 1;     

gNB.PDSCH.DL_DMRS_add_pos = 0;     

gNB.PDSCH.DL_DMRS_config_type = 1;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

   481

   482

   487

   488

 

 

dmrsSymbols =

 

   0.7071 + 0.7071i

   0.7071 + 0.7071i

  -0.7071 - 0.7071i

  -0.7071 + 0.7071i

 

 

 

gNB.PDSCH.NLayers = 1

gNB.PDSCH.PortSet = [7];         

gNB.PDSCH.PDSCHMappingType = 'A';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   

gNB.PDSCH.DL_DMRS_max_len = 1;     

gNB.PDSCH.DL_DMRS_add_pos = 0;     

gNB.PDSCH.DL_DMRS_config_type = 1;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

   481

   482

   487

   488

 

 

dmrsSymbols =

 

   0.7071 + 0.7071i

  -0.7071 - 0.7071i

  -0.7071 - 0.7071i

   0.7071 - 0.7071i

 

 

 

 

gNB.PDSCH.NLayers = 1

gNB.PDSCH.PortSet = [8];         

gNB.PDSCH.PDSCHMappingType = 'A';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   

gNB.PDSCH.DL_DMRS_max_len = 1;     

gNB.PDSCH.DL_DMRS_add_pos = 0;     

gNB.PDSCH.DL_DMRS_config_type = 1;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

   483

   484

   489

   490

 

 

dmrsSymbols =

 

   0.7071 + 0.7071i

   0.7071 + 0.7071i

  -0.7071 - 0.7071i

  -0.7071 + 0.7071i

 

 

 

 

gNB.PDSCH.NLayers = 1

gNB.PDSCH.PortSet = [9];         

gNB.PDSCH.PDSCHMappingType = 'A';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   

gNB.PDSCH.DL_DMRS_max_len = 1;     

gNB.PDSCH.DL_DMRS_add_pos = 0;     

gNB.PDSCH.DL_DMRS_config_type = 1;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

   483

   484

   489

   490

 

 

dmrsSymbols =

 

   0.7071 + 0.7071i

  -0.7071 - 0.7071i

  -0.7071 - 0.7071i

   0.7071 - 0.7071i

 

 

 

 

gNB.PDSCH.NLayers = 1

gNB.PDSCH.PortSet = [10];         

gNB.PDSCH.PDSCHMappingType = 'A';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   

gNB.PDSCH.DL_DMRS_max_len = 1;     

gNB.PDSCH.DL_DMRS_add_pos = 0;     

gNB.PDSCH.DL_DMRS_config_type = 1;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

   485

   486

   491

   492

 

 

dmrsSymbols =

 

   0.7071 + 0.7071i

   0.7071 + 0.7071i

  -0.7071 - 0.7071i

  -0.7071 + 0.7071i

 

 

 

gNB.PDSCH.NLayers = 1

gNB.PDSCH.PortSet = [11];         

gNB.PDSCH.PDSCHMappingType = 'A';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   

gNB.PDSCH.DL_DMRS_max_len = 1;     

gNB.PDSCH.DL_DMRS_add_pos = 0;     

gNB.PDSCH.DL_DMRS_config_type = 1;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

   485

   486

   491

   492

 

 

dmrsSymbols =

 

   0.7071 + 0.7071i

  -0.7071 - 0.7071i

  -0.7071 - 0.7071i

   0.7071 - 0.7071i

 

 

 

gNB.PDSCH.NLayers = 1

gNB.PDSCH.PortSet = [0];         

gNB.PDSCH.PDSCHMappingType = 'B';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   

gNB.PDSCH.DL_DMRS_max_len = 1;     

gNB.PDSCH.DL_DMRS_add_pos = 0;     % this is used only when Duration of PDSCH transmission = 7

                                   % when MappingType = B

gNB.PDSCH.DL_DMRS_config_type = 2;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

     1

     2

     7

     8

 

 

dmrsSymbols =

 

  -0.7071 - 0.7071i

  -0.7071 + 0.7071i

   0.7071 - 0.7071i

   0.7071 + 0.7071i

 

 

 

gNB.PDSCH.NLayers = 1

gNB.PDSCH.PortSet = [0];         

gNB.PDSCH.PDSCHMappingType = 'B';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   % This parameter has no impact on when MappingType = B

gNB.PDSCH.DL_DMRS_max_len = 2;     

gNB.PDSCH.DL_DMRS_add_pos = 0;     % this is used only when Duration of PDSCH transmission = 7

                                   % when MappingType = B

gNB.PDSCH.DL_DMRS_config_type = 2;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

     1

     2

     7

     8

   241

   242

   247

   248

 

 

dmrsSymbols =

 

  -0.7071 - 0.7071i

  -0.7071 + 0.7071i

   0.7071 - 0.7071i

   0.7071 + 0.7071i

   0.7071 + 0.7071i

  -0.7071 - 0.7071i

   0.7071 + 0.7071i

   0.7071 - 0.7071i

 

 

 

gNB.PDSCH.NLayers = 1

gNB.PDSCH.PortSet = [0];         

gNB.PDSCH.PDSCHMappingType = 'B';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   % This parameter has no impact on when MappingType = B

gNB.PDSCH.DL_DMRS_max_len = 1;     

gNB.PDSCH.DL_DMRS_add_pos = 0;     % this is used only when Duration of PDSCH transmission = 7

                                   % when MappingType = B

gNB.PDSCH.DL_DMRS_config_type = 1;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

     1

     3

     5

     7

     9

    11

 

 

dmrsSymbols =

 

  -0.7071 - 0.7071i

  -0.7071 + 0.7071i

   0.7071 - 0.7071i

   0.7071 + 0.7071i

  -0.7071 + 0.7071i

  -0.7071 + 0.7071i

 

 

 

gNB.PDSCH.NLayers = 1

gNB.PDSCH.PortSet = [0];         

gNB.PDSCH.PDSCHMappingType = 'B';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   % This parameter has no impact on when MappingType = B

gNB.PDSCH.DL_DMRS_max_len = 2;     

gNB.PDSCH.DL_DMRS_add_pos = 0;     % this is used only when Duration of PDSCH transmission = 7

                                   % when MappingType = B

gNB.PDSCH.DL_DMRS_config_type = 1;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

     1

     3

     5

     7

     9

    11

   241

   243

   245

   247

   249

   251

 

 

dmrsSymbols =

 

  -0.7071 - 0.7071i

  -0.7071 + 0.7071i

   0.7071 - 0.7071i

   0.7071 + 0.7071i

  -0.7071 + 0.7071i

  -0.7071 + 0.7071i

   0.7071 + 0.7071i

  -0.7071 - 0.7071i

   0.7071 + 0.7071i

   0.7071 - 0.7071i

  -0.7071 - 0.7071i

  -0.7071 - 0.7071i

 

 

 

< Case 2 > gNB.PDSCH.NLayers = 2; gNB.PDSCH.PortSet = [0,2];

 

NOTE : In this example, I added some additional explains and guiding lines on the plot to help you interpret the meaning of the plot. But these additional comments will not be added in other examples.

 

gNB.PDSCH.NLayers = 2

gNB.PDSCH.PortSet = [0,2];         

gNB.PDSCH.PDSCHMappingType = 'A';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   

gNB.PDSCH.DL_DMRS_max_len = 1;     

gNB.PDSCH.DL_DMRS_add_pos = 0;     

gNB.PDSCH.DL_DMRS_config_type = 2;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

         481        3843

         482        3844

         487        3849

         488        3850

 

 

dmrsSymbols =

 

   0.7071 + 0.7071i   0.7071 + 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

  -0.7071 - 0.7071i  -0.7071 - 0.7071i

  -0.7071 + 0.7071i  -0.7071 + 0.7071i

 

 

 

gNB.PDSCH.NLayers = 2

gNB.PDSCH.PortSet = [0,2];         

gNB.PDSCH.PDSCHMappingType = 'A';  

gNB.PDSCH.DL_DMRS_typeA_pos = 3;   

gNB.PDSCH.DL_DMRS_max_len = 1;     

gNB.PDSCH.DL_DMRS_add_pos = 0;     

gNB.PDSCH.DL_DMRS_config_type = 2;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

         721        4083

         722        4084

         727        4089

         728        4090

 

 

dmrsSymbols =

 

  -0.7071 - 0.7071i  -0.7071 - 0.7071i

   0.7071 - 0.7071i   0.7071 - 0.7071i

  -0.7071 + 0.7071i  -0.7071 + 0.7071i

  -0.7071 - 0.7071i  -0.7071 - 0.7071i

 

 

 

gNB.PDSCH.PortSet = [0,2];         

gNB.PDSCH.PDSCHMappingType = 'A';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   

gNB.PDSCH.DL_DMRS_max_len = 2;     

gNB.PDSCH.DL_DMRS_add_pos = 0;     

gNB.PDSCH.DL_DMRS_config_type = 2;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

         481        3843

         482        3844

         487        3849

         488        3850

         721        4083

         722        4084

         727        4089

         728        4090

 

 

dmrsSymbols =

 

   0.7071 + 0.7071i   0.7071 + 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

  -0.7071 - 0.7071i  -0.7071 - 0.7071i

  -0.7071 + 0.7071i  -0.7071 + 0.7071i

  -0.7071 - 0.7071i  -0.7071 - 0.7071i

   0.7071 - 0.7071i   0.7071 - 0.7071i

  -0.7071 + 0.7071i  -0.7071 + 0.7071i

  -0.7071 - 0.7071i  -0.7071 - 0.7071i

 

 

 

gNB.PDSCH.NLayers = 2

gNB.PDSCH.PortSet = [0,2];         

gNB.PDSCH.PDSCHMappingType = 'A';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   

gNB.PDSCH.DL_DMRS_max_len = 1;     

gNB.PDSCH.DL_DMRS_add_pos = 1;     

gNB.PDSCH.DL_DMRS_config_type = 2;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

         481        3843

         482        3844

         487        3849

         488        3850

        2641        6003

        2642        6004

        2647        6009

        2648        6010

 

 

dmrsSymbols =

 

   0.7071 + 0.7071i   0.7071 + 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

  -0.7071 - 0.7071i  -0.7071 - 0.7071i

  -0.7071 + 0.7071i  -0.7071 + 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

  -0.7071 + 0.7071i  -0.7071 + 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

   0.7071 - 0.7071i   0.7071 - 0.7071i

 

 

 

gNB.PDSCH.NLayers = 2

gNB.PDSCH.PortSet = [0,2];         

gNB.PDSCH.PDSCHMappingType = 'A';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   

gNB.PDSCH.DL_DMRS_max_len = 1;     

gNB.PDSCH.DL_DMRS_add_pos = 2;     

gNB.PDSCH.DL_DMRS_config_type = 2;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

         481        3843

         482        3844

         487        3849

         488        3850

        1681        5043

        1682        5044

        1687        5049

        1688        5050

        2641        6003

        2642        6004

        2647        6009

        2648        6010

 

 

dmrsSymbols =

 

   0.7071 + 0.7071i   0.7071 + 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

  -0.7071 - 0.7071i  -0.7071 - 0.7071i

  -0.7071 + 0.7071i  -0.7071 + 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

  -0.7071 + 0.7071i  -0.7071 + 0.7071i

  -0.7071 - 0.7071i  -0.7071 - 0.7071i

  -0.7071 + 0.7071i  -0.7071 + 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

  -0.7071 + 0.7071i  -0.7071 + 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

   0.7071 - 0.7071i   0.7071 - 0.7071i

 

 

 

gNB.PDSCH.NLayers = 2

gNB.PDSCH.PortSet = [0,2];         

gNB.PDSCH.PDSCHMappingType = 'A';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   

gNB.PDSCH.DL_DMRS_max_len = 1;     

gNB.PDSCH.DL_DMRS_add_pos = 3;     

gNB.PDSCH.DL_DMRS_config_type = 2;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

         481        3843

         482        3844

         487        3849

         488        3850

        1201        4563

        1202        4564

        1207        4569

        1208        4570

        1921        5283

        1922        5284

        1927        5289

        1928        5290

        2641        6003

        2642        6004

        2647        6009

        2648        6010

 

 

dmrsSymbols =

 

   0.7071 + 0.7071i   0.7071 + 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

  -0.7071 - 0.7071i  -0.7071 - 0.7071i

  -0.7071 + 0.7071i  -0.7071 + 0.7071i

  -0.7071 - 0.7071i  -0.7071 - 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

   0.7071 - 0.7071i   0.7071 - 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

   0.7071 - 0.7071i   0.7071 - 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

  -0.7071 + 0.7071i  -0.7071 + 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

  -0.7071 + 0.7071i  -0.7071 + 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

   0.7071 - 0.7071i   0.7071 - 0.7071i

 

 

 

gNB.PDSCH.NLayers = 2

gNB.PDSCH.PortSet = [0,2];         

gNB.PDSCH.PDSCHMappingType = 'A';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   

gNB.PDSCH.DL_DMRS_max_len = 1;     

gNB.PDSCH.DL_DMRS_add_pos = 0;     

gNB.PDSCH.DL_DMRS_config_type = 1;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

         481        3842

         483        3844

         485        3846

         487        3848

         489        3850

         491        3852

 

 

dmrsSymbols =

 

   0.7071 + 0.7071i   0.7071 + 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

  -0.7071 - 0.7071i  -0.7071 - 0.7071i

  -0.7071 + 0.7071i  -0.7071 + 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

 

 

 

gNB.PDSCH.NLayers = 2

gNB.PDSCH.PortSet = [0,2];         

gNB.PDSCH.PDSCHMappingType = 'A';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   

gNB.PDSCH.DL_DMRS_max_len = 2;     

gNB.PDSCH.DL_DMRS_add_pos = 0;     

gNB.PDSCH.DL_DMRS_config_type = 1;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

         481        3842

         483        3844

         485        3846

         487        3848

         489        3850

         491        3852

         721        4082

         723        4084

         725        4086

         727        4088

         729        4090

         731        4092

 

 

dmrsSymbols =

 

   0.7071 + 0.7071i   0.7071 + 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

  -0.7071 - 0.7071i  -0.7071 - 0.7071i

  -0.7071 + 0.7071i  -0.7071 + 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

  -0.7071 - 0.7071i  -0.7071 - 0.7071i

   0.7071 - 0.7071i   0.7071 - 0.7071i

  -0.7071 + 0.7071i  -0.7071 + 0.7071i

  -0.7071 - 0.7071i  -0.7071 - 0.7071i

   0.7071 - 0.7071i   0.7071 - 0.7071i

   0.7071 - 0.7071i   0.7071 - 0.7071i

 

 

 

gNB.PDSCH.NLayers = 2

gNB.PDSCH.PortSet = [0,2];         

gNB.PDSCH.PDSCHMappingType = 'A';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   

gNB.PDSCH.DL_DMRS_max_len = 1;     

gNB.PDSCH.DL_DMRS_add_pos = 3;     

gNB.PDSCH.DL_DMRS_config_type = 1;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

         481        3842

         483        3844

         485        3846

         487        3848

         489        3850

         491        3852

        1201        4562

        1203        4564

        1205        4566

        1207        4568

        1209        4570

        1211        4572

        1921        5282

        1923        5284

        1925        5286

        1927        5288

        1929        5290

        1931        5292

        2641        6002

        2643        6004

        2645        6006

        2647        6008

        2649        6010

        2651        6012

 

 

dmrsSymbols =

 

   0.7071 + 0.7071i   0.7071 + 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

  -0.7071 - 0.7071i  -0.7071 - 0.7071i

  -0.7071 + 0.7071i  -0.7071 + 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

  -0.7071 - 0.7071i  -0.7071 - 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

   0.7071 - 0.7071i   0.7071 - 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

  -0.7071 + 0.7071i  -0.7071 + 0.7071i

  -0.7071 + 0.7071i  -0.7071 + 0.7071i

   0.7071 - 0.7071i   0.7071 - 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

  -0.7071 + 0.7071i  -0.7071 + 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

   0.7071 - 0.7071i   0.7071 - 0.7071i

  -0.7071 + 0.7071i  -0.7071 + 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

  -0.7071 + 0.7071i  -0.7071 + 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

   0.7071 - 0.7071i   0.7071 - 0.7071i

  -0.7071 - 0.7071i  -0.7071 - 0.7071i

  -0.7071 - 0.7071i  -0.7071 - 0.7071i

 

 

 

gNB.PDSCH.NLayers = 2

gNB.PDSCH.PortSet = [0,2];         

gNB.PDSCH.PDSCHMappingType = 'B';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   

gNB.PDSCH.DL_DMRS_max_len = 1;     

gNB.PDSCH.DL_DMRS_add_pos = 0;     % this is used only when Duration of PDSCH transmission = 7

                                   % when MappingType = B

gNB.PDSCH.DL_DMRS_config_type = 2;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

           1        3363

           2        3364

           7        3369

           8        3370

 

 

dmrsSymbols =

 

  -0.7071 - 0.7071i  -0.7071 - 0.7071i

  -0.7071 + 0.7071i  -0.7071 + 0.7071i

   0.7071 - 0.7071i   0.7071 - 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

 

 

 

gNB.PDSCH.NLayers = 2

gNB.PDSCH.PortSet = [0,2];         

gNB.PDSCH.PDSCHMappingType = 'B';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   % This parameter has no impact on when MappingType = B

gNB.PDSCH.DL_DMRS_max_len = 2;     

gNB.PDSCH.DL_DMRS_add_pos = 0;     % this is used only when Duration of PDSCH transmission = 7

                                   % when MappingType = B

gNB.PDSCH.DL_DMRS_config_type = 2;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

           1        3363

           2        3364

           7        3369

           8        3370

         241        3603

         242        3604

         247        3609

         248        3610

 

 

dmrsSymbols =

 

  -0.7071 - 0.7071i  -0.7071 - 0.7071i

  -0.7071 + 0.7071i  -0.7071 + 0.7071i

   0.7071 - 0.7071i   0.7071 - 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

  -0.7071 - 0.7071i  -0.7071 - 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

   0.7071 - 0.7071i   0.7071 - 0.7071i

 

 

 

gNB.PDSCH.NLayers = 2

gNB.PDSCH.PortSet = [0,2];         

gNB.PDSCH.PDSCHMappingType = 'B';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   % This parameter has no impact on when MappingType = B

gNB.PDSCH.DL_DMRS_max_len = 1;     

gNB.PDSCH.DL_DMRS_add_pos = 0;     % this is used only when Duration of PDSCH transmission = 7

                                   % when MappingType = B

gNB.PDSCH.DL_DMRS_config_type = 1;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

           1        3362

           3        3364

           5        3366

           7        3368

           9        3370

          11        3372

 

 

dmrsSymbols =

 

  -0.7071 - 0.7071i  -0.7071 - 0.7071i

  -0.7071 + 0.7071i  -0.7071 + 0.7071i

   0.7071 - 0.7071i   0.7071 - 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

  -0.7071 + 0.7071i  -0.7071 + 0.7071i

  -0.7071 + 0.7071i  -0.7071 + 0.7071i

 

 

 

gNB.PDSCH.NLayers = 2

gNB.PDSCH.PortSet = [0,2];         

gNB.PDSCH.PDSCHMappingType = 'B';  

gNB.PDSCH.DL_DMRS_typeA_pos = 2;   % This parameter has no impact on when MappingType = B

gNB.PDSCH.DL_DMRS_max_len = 2;     

gNB.PDSCH.DL_DMRS_add_pos = 0;     % this is used only when Duration of PDSCH transmission = 7

                                   % when MappingType = B

gNB.PDSCH.DL_DMRS_config_type = 1;

gNB.PDSCH.NIDNSCID = 1;            

gNB.PDSCH.NSCID = 0;               

pdschDmrsIndices =

 

           1        3362

           3        3364

           5        3366

           7        3368

           9        3370

          11        3372

         241        3602

         243        3604

         245        3606

         247        3608

         249        3610

         251        3612

 

 

dmrsSymbols =

 

  -0.7071 - 0.7071i  -0.7071 - 0.7071i

  -0.7071 + 0.7071i  -0.7071 + 0.7071i

   0.7071 - 0.7071i   0.7071 - 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

  -0.7071 + 0.7071i  -0.7071 + 0.7071i

  -0.7071 + 0.7071i  -0.7071 + 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

  -0.7071 - 0.7071i  -0.7071 - 0.7071i

   0.7071 + 0.7071i   0.7071 + 0.7071i

   0.7071 - 0.7071i   0.7071 - 0.7071i

  -0.7071 - 0.7071i  -0.7071 - 0.7071i

  -0.7071 - 0.7071i  -0.7071 - 0.7071i