Matlab Toolbox - 4G/LTE

 

 

 

 

RMC Dlownlink - Port5, NLayer = 1, NTxAnts = N

 

< Generating RMC Downlink Signal >

    rc = 'R.25';

     

    rmc = lteRMCDL(rc)

    pdsch = rmc.PDSCH

     

    txData = [0;0;0;0];

    [txWaveform, txGrid, rmcCfgOut] = lteRMCDLTool(rmc, txData);

     

    SF_RE_NUM = rmc.NDLRB*12*14;

    TxAntIndex = 1;

    TxAnt = TxAntIndex + 1;

     

    txGrid = txGrid(:,:,TxAnt);

    txGridChMap = txGrid(:,:,1);

     

    crs_scale = 0.2;

    pss_scale = 0.3;

    sss_scale = 0.3;

    phich_scale = 0.7;

    pcfich_scale = 0.8;

    pbch_scale = 0.7;

    pdcch_scale = 0.5;

    pdsch_scale = 0.4;

     

    noPdschSubframe = [2 3 5 7 8];

     

    for i=0:9

        rmc.NSubframe = i;

        pdsch = rmc.PDSCH;

        indexOffset = (rmc.NDLRB * 12 * 14) * rmc.NSubframe;

        crs_sym_ind = lteCellRSIndices(rmc)+indexOffset;

        

        if (i == 0) || (i == 5)

            pss_sym_ind = ltePSSIndices(rmc)+indexOffset;

            sss_sym_ind = lteSSSIndices(rmc)+indexOffset;

        end

        

        pcfich_sym_ind = ltePCFICHIndices(rmc)+indexOffset;

        phich_sym_ind = ltePHICHIndices(rmc)+indexOffset;

     

        if i == 0

            pbch_sym_ind = ltePBCHIndices(rmc)+indexOffset;

        end

        

        dci.NDLRB = rmc.NDLRB;

        dci.DCIFormat = pdsch.DCIFormat;

        dci.AllocationType = 0;

        dci.Allocation.RIV = 18;

        dci.ModCoding = 10;

        dci.HARQNo = 0;

        dci.NewData = 0;

        dci.TPCPUCCH = 0;

        dci.DuplexMode = 'FDD';

        dci.NTxAnts = 1;

        [dciMessage,dciMessageBits] = lteDCI(rmc,dci);

        

        pdcchConfig.RNTI = pdsch.RNTI;

        pdcchConfig.PDCCHFormat = pdsch.PDCCHFormat;

        

        codedDciBits = lteDCIEncode(pdcchConfig, dciMessageBits);

        pdcchDims = ltePDCCHInfo(rmc);

        pdcchBits = -1*ones(pdcchDims.MTot, 1);

        candidates = ltePDCCHSpace(rmc, pdcchConfig);

        pdcchBits ( candidates(1, 1) : candidates(1, 2) ) = codedDciBits;

        pdcch_sym = ltePDCCH(rmc, pdcchBits);

        

        pdcch_sym_ind = ltePDCCHIndices(rmc)+indexOffset;

            

        if ismember(i,noPdschSubframe) == false

           if iscell(pdsch.PRBSet) == true

              [pdsch_sym_ind,pdschIndInfo]=ltePDSCHIndices(rmc,pdsch,cell2mat(pdsch.PRBSet(i+1)));

           else   

              [pdsch_sym_ind,pdschIndInfo]=ltePDSCHIndices(rmc,pdsch,pdsch.PRBSet);

           end   

           pdsch_sym_ind = pdsch_sym_ind + indexOffset;

        end     

        

        if TxAntIndex == 0

            txGridChMap(crs_sym_ind) = crs_scale;

            txGridChMap(pss_sym_ind) = pss_scale;

            txGridChMap(sss_sym_ind) = sss_scale;

            txGridChMap(pcfich_sym_ind) = pcfich_scale;

            txGridChMap(phich_sym_ind) = phich_scale;

            txGridChMap(pbch_sym_ind) = pbch_scale;

        

            txGridChMap(pdcch_sym_ind) = pdcch_scale .* pdcch_sym;

        end

        

        if ismember(i,noPdschSubframe) == false

            txGridChMap(pdsch_sym_ind(:,TxAnt)-SF_RE_NUM*TxAntIndex) = pdsch_scale;

        end

    end

     

    ylabelText = {'0','1','2','3','4','5','6','7','8','9', ...

              '10','11','12','13','14','15','16','17','18','19', ...

              '20','21','22','23','24','25','26','27','28','29', ...

              '30','31','32','33','34','35','36','37','38','39', ...

              '40','41','42','43','44','45','46','47','48','49', ...

              '50','51','52','53','54','55','56','57','58','59', ...

              '60','61','62','63','64','65','66','67','68','69', ...

              '70','71','72','73','74','75','76','77','78','79', ...

              '80','81','82','83','84','85','86','87','88','89', ...

              '90','91','92','93','94','95','96','97','98','99'};

    ytick = 7:12:(rmc.NDLRB*12);

     

    subplot(2,2,1);

    imagesc(abs(txGrid));

    axis xy;

    xlabel('Subframe');

    ylabel('RB');

    set(gca,'xtick',8:14:140);

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

    set(gca,'ytick',ytick);

    set(gca,'yticklabel',ylabelText);

     

     

    subplot(2,2,3);

    imagesc(abs(txGridChMap));

    axis xy;

    xlabel('Subframe');

    ylabel('RB');

    set(gca,'xtick',8:14:140);

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

    set(gca,'ytick',ytick);

    set(gca,'yticklabel',ylabelText);

     

    subplot(2,2,[2 4]);

    imagesc(abs(txGridChMap));

    axis xy;

    xlabel('Symbol');

    ylabel('RB');

    xlim([0.5 14.5]);

    ylim([0.5 12*rmc.NDLRB]);

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

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

    set(gca,'ytick',ytick);

    set(gca,'yticklabel',ylabelText);

     

    mymap = [0.0 0.0 0.0

             1.0 1.0 0.0

             1.0 0.0 0.0

             0.5 0.0 0.0

             0.0 1.0 0.0

             0.0 0.5 0.0

             0.0 0.0 1.0

             0.0 0.0 0.5

             0.0 1.0 1.0

             1.0 0.0 1.0

             1.0 1.0 1.0];

    colormap(mymap);

     

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

     

 

rc = 'R.25'; TxAntIndex = 0

36.101 v14.4 - Table A.3.4.3.1-1: Fixed Reference Channel for DRS   

rc = 'R.25'; TxAntIndex = 1

 

rmc =

 

  struct with fields:

 

                 RC: 'R.25'

              NDLRB: 50

           CellRefP: 1

            NCellID: 0

       CyclicPrefix: 'Normal'

                CFI: 2

        PCFICHPower: 0

                 Ng: 'Sixth'

      PHICHDuration: 'Normal'

              HISet: [112×3 double]

         PHICHPower: 0

             NFrame: 0

          NSubframe: 0

       TotSubframes: 10

          Windowing: 0

         DuplexMode: 'TDD'

              PDSCH: [1×1 struct]

    OCNGPDCCHEnable: 'Off'

     OCNGPDCCHPower: 0

    OCNGPDSCHEnable: 'Off'

     OCNGPDSCHPower: 0

          OCNGPDSCH: [1×1 struct]

                SSC: 4

          TDDConfig: 1

 

 

pdsch =

 

  struct with fields:

 

           TxScheme: 'Port5'

         Modulation: {'QPSK'}

            NLayers: 1

                Rho: 0

               RNTI: 1

              RVSeq: [0 1 2 3]

                 RV: 0

     NHARQProcesses: 7

       NTurboDecIts: 5

             PRBSet: {1×10 cell}

     TargetCodeRate: 0.3333

     ActualCodeRate: [0.2911 0.3152 0 0 0.3505 0 0.3152 0 0 0.3505]

         TrBlkSizes: [2984 3240 0 0 4392 0 3240 0 0 4392]

    CodedTrBlkSizes: [10332 10356 0 0 12600 0 10356 0 0 12600]

          DCIFormat: 'Format1'

        PDCCHFormat: 2

         PDCCHPower: 0

            CSIMode: 'PUCCH 1-1'

            PMIMode: 'Wideband'

                  W: [0.7071 + 0.0000i 0.7071 + 0.0000i]

            NTxAnts: 2

 

 

rc = 'R.26'; TxAntIndex = 0

36.101 v14.4 - Table A.3.4.3.1-1: Fixed Reference Channel for DRS   

rc = 'R.26'; TxAntIndex = 1

 

rmc =

 

  struct with fields:

 

                 RC: 'R.26'

              NDLRB: 50

           CellRefP: 1

            NCellID: 0

       CyclicPrefix: 'Normal'

                CFI: 2

        PCFICHPower: 0

                 Ng: 'Sixth'

      PHICHDuration: 'Normal'

              HISet: [112×3 double]

         PHICHPower: 0

             NFrame: 0

          NSubframe: 0

       TotSubframes: 10

          Windowing: 0

         DuplexMode: 'TDD'

              PDSCH: [1×1 struct]

    OCNGPDCCHEnable: 'Off'

     OCNGPDCCHPower: 0

    OCNGPDSCHEnable: 'Off'

     OCNGPDSCHPower: 0

          OCNGPDSCH: [1×1 struct]

                SSC: 4

          TDDConfig: 1

 

 

pdsch =

 

  struct with fields:

 

           TxScheme: 'Port5'

         Modulation: {'16QAM'}

            NLayers: 1

                Rho: 0

               RNTI: 1

              RVSeq: [0 1 2 3]

                 RV: 0

     NHARQProcesses: 7

       NTurboDecIts: 5

             PRBSet: {1×10 cell}

     TargetCodeRate: 0.5000

     ActualCodeRate: [0.4646 0.4635 0 0 0.5181 0 0.4635 0 0 0.5181]

         TrBlkSizes: [9528 9528 0 0 12960 0 9528 0 0 12960]

    CodedTrBlkSizes: [20664 20712 0 0 25200 0 20712 0 0 25200]

          DCIFormat: 'Format1'

        PDCCHFormat: 2

         PDCCHPower: 0

            CSIMode: 'PUCCH 1-1'

            PMIMode: 'Wideband'

                  W: [0.7071 + 0.0000i 0.7071 + 0.0000i]

            NTxAnts: 2

 

 

rc = 'R.27'; TxAntIndex = 0

36.101 v14.4 - Table A.3.4.3.1-1: Fixed Reference Channel for DRS   

rc = 'R.27'; TxAntIndex = 1

 

rmc =

 

  struct with fields:

 

                 RC: 'R.27'

              NDLRB: 50

           CellRefP: 1

            NCellID: 0

       CyclicPrefix: 'Normal'

                CFI: 2

        PCFICHPower: 0

                 Ng: 'Sixth'

      PHICHDuration: 'Normal'

              HISet: [112×3 double]

         PHICHPower: 0

             NFrame: 0

          NSubframe: 0

       TotSubframes: 10

          Windowing: 0

         DuplexMode: 'TDD'

              PDSCH: [1×1 struct]

    OCNGPDCCHEnable: 'Off'

     OCNGPDCCHPower: 0

    OCNGPDSCHEnable: 'Off'

     OCNGPDSCHPower: 0

          OCNGPDSCH: [1×1 struct]

                SSC: 4

          TDDConfig: 1

 

 

pdsch =

 

  struct with fields:

 

           TxScheme: 'Port5'

         Modulation: {'64QAM'}

            NLayers: 1

                Rho: 0

               RNTI: 1

              RVSeq: [0 0 1 2]

                 RV: 0

     NHARQProcesses: 7

       NTurboDecIts: 5

             PRBSet: {1×10 cell}

     TargetCodeRate: 0.7500

     ActualCodeRate: [0.7185 0.7416 0 0 0.7534 0 0.7416 0 0 0.7534]

         TrBlkSizes: [22152 22920 0 0 28336 0 22920 0 0 28336]

    CodedTrBlkSizes: [30996 31068 0 0 37800 0 31068 0 0 37800]

          DCIFormat: 'Format1'

        PDCCHFormat: 2

         PDCCHPower: 0

            CSIMode: 'PUCCH 1-1'

            PMIMode: 'Wideband'

                  W: [0.7071 + 0.0000i 0.7071 + 0.0000i]

            NTxAnts: 2

 

 

rc = 'R.28'; TxAntIndex = 0

36.101 v14.4 - Table A.3.4.3.1-1: Fixed Reference Channel for DRS   

rc = 'R.28'; TxAntIndex = 1

 

rmc =

 

  struct with fields:

 

                 RC: 'R.28'

              NDLRB: 50

           CellRefP: 1

            NCellID: 0

       CyclicPrefix: 'Normal'

                CFI: 2

        PCFICHPower: 0

                 Ng: 'Sixth'

      PHICHDuration: 'Normal'

              HISet: [112×3 double]

         PHICHPower: 0

             NFrame: 0

          NSubframe: 0

       TotSubframes: 10

          Windowing: 0

         DuplexMode: 'TDD'

              PDSCH: [1×1 struct]

    OCNGPDCCHEnable: 'Off'

     OCNGPDCCHPower: 0

    OCNGPDSCHEnable: 'Off'

     OCNGPDSCHPower: 0

          OCNGPDSCH: [1×1 struct]

                SSC: 4

          TDDConfig: 1

 

 

pdsch =

 

  struct with fields:

 

           TxScheme: 'Port5'

         Modulation: {'16QAM'}

            NLayers: 1

                Rho: 0

               RNTI: 1

              RVSeq: [0 1 2 3]

                 RV: 0

     NHARQProcesses: 7

       NTurboDecIts: 5

             PRBSet: 0

     TargetCodeRate: 0.5000

     ActualCodeRate: [0.4921 0.4762 0 0 0.4921 0 0.4762 0 0 0.4921]

         TrBlkSizes: [224 176 0 0 224 0 176 0 0 224]

    CodedTrBlkSizes: [504 420 0 0 504 0 420 0 0 504]

          DCIFormat: 'Format1'

        PDCCHFormat: 2

         PDCCHPower: 0

            CSIMode: 'PUCCH 1-1'

            PMIMode: 'Wideband'

                  W: [0.7071 + 0.0000i 0.7071 + 0.0000i]

            NTxAnts: 2

 

 

 

 

Disclaimer ! :

 

This page is only to show you the overall logics and visualization for various LTE physical layer channels. I haven't investigated much about verifying about the accuracy.

If you think the code is not so efficient, it is 100% my fault. I haven't made any effort for effiecient code. I just tried to create code as simple as possible for the readers. As you know, easy-to-read code is not always efficient for a specific chipset.

If you find any mistake in terms of accuracy, it is also very highly likely be my fault. Not the problem of Matlab tool box itself.

Any comment and corrections if you find any mistake will be welcome and appreciated.