Matlab Toolbox - 4G/LTE

 

 

 

 

PUSCH - User Data

 

Description/explanation will come later !

 

< Generation of PUSCH Symbol >

    ue1.NCellID = 0;

    ue1.CyclicPrefixUL = 'Normal';

    ue1.NSubframe = 1;

    ue1.Hopping = 'Off';

    ue1.NULRB = 6;

    ue1.Shortened = 0;

    ue1.NTxAnts = 1;

    ue1.SeqGroup = 0;

    ue1.CyclicShift = 0;

    ue1.RNTI = 1;

     

    pusch.PRBSet = (0:5).';

    pusch.Modulation = 'QPSK';

    pusch.RV = 0;

    pusch.DynCyclicShift = 0;

    pusch.NLayers = 1;

    pusch.OrthCover = 'Off';

     

    pusch_dmrs_sym = ltePUSCHDRS(ue1,pusch);

    pusch_dmrs_sym_arrayIndex = 0:length(pusch_dmrs_sym)-1;

    pusch_dmrs_sym_ind = ltePUSCHDRSIndices(ue1,pusch);

     

    pusch_trblk = round(rand(1,504));

    pusch_cw = lteULSCH(ue1,pusch,pusch_trblk);

    pusch_sym = ltePUSCH(ue1,pusch,pusch_cw);

    pusch_sym_arrayIndex = 0:length(pusch_sym)-1;

    pusch_sym_ind = ltePUSCHIndices(ue1,pusch);

     

    subplot(1,3,1);

    plot(real(pusch_sym),imag(pusch_sym),'ro','MarkerFaceColor',[1 0 0]);

    axis([-3 3 -3 3]);

    title('Constellation');

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

    plot(pusch_sym_arrayIndex,real(pusch_sym),'ro-',pusch_sym_arrayIndex,imag(pusch_sym),'bo-');

    xlim([0 max(pusch_sym_arrayIndex)]);

    title('PUSCH index vs PUSCH value. Red -> real, Blue -> Imaginary');

     

     

      ue1.NCellID = 0;

      ue1.NSubframe = 0;

      ue1.NULRB = 6;

      ue1.Shortened = 0;

      ue1.NTxAnts = 1;

       

      pusch.PRBSet = (0:5).';

      pusch.Modulation = 'QPSK';

      pusch.RV = 0;

      pusch.DynCyclicShift = 0;

     

     

 

< Displaying PUSCH OFDM Symbol Data >

    ue1.NCellID = 0;

    ue1.CyclicPrefixUL = 'Normal';

    ue1.NSubframe = 1;

    ue1.Hopping = 'Off';

    ue1.NULRB = 6;

    ue1.Shortened = 0;

    ue1.NTxAnts = 1;

    ue1.SeqGroup = 0;

    ue1.CyclicShift = 0;

    ue1.RNTI = 1;

     

    pusch.PRBSet = (0:5).';

    pusch.Modulation = 'QPSK';

    pusch.RV = 0;

    pusch.DynCyclicShift = 0;

    pusch.NLayers = 1;

    pusch.OrthCover = 'Off';

     

    pusch_dmrs_sym = ltePUSCHDRS(ue1,pusch);

    pusch_dmrs_sym_arrayIndex = 0:length(pusch_dmrs_sym)-1;

    pusch_dmrs_sym_ind = ltePUSCHDRSIndices(ue1,pusch);

     

    pusch_trblk = round(rand(1,504));

    pusch_cw = lteULSCH(ue1,pusch,pusch_trblk);

    pusch_sym = ltePUSCH(ue1,pusch,pusch_cw);

    pusch_sym_arrayIndex = 0:length(pusch_sym)-1;

    pusch_sym_ind = ltePUSCHIndices(ue1,pusch);

     

    resourceGridUL = lteULResourceGrid(ue1);

    resourceGridUL(pusch_dmrs_sym_ind) = pusch_dmrs_sym;

    resourceGridUL(pusch_sym_ind) = pusch_sym;

     

    phy_sym_length = ue1.NULRB * 12;

    pusch_sym_ind_matrix = reshape(pusch_sym_ind,phy_sym_length,12);

    phy_sym_ind = pusch_sym_ind(1:phy_sym_length);

     

    plot_sym_range = 1:length(phy_sym_ind);

     

    for pusch_sym_no = 1:12

        phy_sym_data = resourceGridUL(pusch_sym_ind_matrix(:,pusch_sym_no));

        

        subplot(12,6,6*(pusch_sym_no-1) + 1);

        plot(real(phy_sym_data),imag(phy_sym_data),'ro','MarkerFaceColor',[1 0 0]);

        axis([-3 3 -3 3]);

        set(gca,'xticklabel',[]); set(gca,'yticklabel',[]);

        set(gca,'xtick',[]);set(gca,'ytick',[]);

     

        subplot(12,6,[(6*(pusch_sym_no-1) + 2) : (6*(pusch_sym_no-1) + 6)]);

        plot(plot_sym_range,real(phy_sym_data),'ro-',...

             plot_sym_range,imag(phy_sym_data),'bo-');

        xlim([0 max(plot_sym_range)]);

        set(gca,'xticklabel',[]); set(gca,'yticklabel',[]);

        set(gca,'xtick',[]);set(gca,'ytick',[]);

    end;

     

      ue1.NCellID = 0;

      ue1.NSubframe = 0;

      ue1.NULRB = 6;

      ue1.Shortened = 0;

      ue1.NTxAnts = 1;

       

      pusch.PRBSet = (0:5).';

      pusch.Modulation = 'QPSK';

      pusch.RV = 0;

      pusch.DynCyclicShift = 0;

     

 

 

< Displaying PUSCH Constellation >

 

    ue1.NCellID = 0;

    ue1.CyclicPrefixUL = 'Normal';

    ue1.NSubframe = 1;

    ue1.Hopping = 'Off';

    ue1.NULRB = 6;

    ue1.Shortened = 0;

    ue1.NTxAnts = 1;

    ue1.SeqGroup = 0;

    ue1.CyclicShift = 0;

    ue1.RNTI = 1;

     

    pusch.PRBSet = (0:5).';

    pusch.Modulation = 'QPSK';

    pusch.RV = 0;

    pusch.DynCyclicShift = 0;

    pusch.NLayers = 1;

    pusch.OrthCover = 'Off';

     

    pusch_dmrs_sym = ltePUSCHDRS(ue1,pusch);

    pusch_dmrs_sym_arrayIndex = 0:length(pusch_dmrs_sym)-1;

    pusch_dmrs_sym_ind = ltePUSCHDRSIndices(ue1,pusch);

     

    pusch_trblk = round(rand(1,504));

    pusch_cw = lteULSCH(ue1,pusch,pusch_trblk);

    pusch_sym = ltePUSCH(ue1,pusch,pusch_cw);

    pusch_sym_arrayIndex = 0:length(pusch_sym)-1;

    pusch_sym_ind = ltePUSCHIndices(ue1,pusch);

     

    resourceGridUL = lteULResourceGrid(ue1);

    resourceGridUL(pusch_dmrs_sym_ind) = pusch_dmrs_sym;

    resourceGridUL(pusch_sym_ind) = pusch_sym;

     

    phy_sym_length = ue1.NULRB * 12;

    pusch_sym_ind_matrix = reshape(pusch_sym_ind,phy_sym_length,12);

    phy_sym_ind = pusch_sym_ind(1:phy_sym_length);

     

    plot_sym_range = 1:length(phy_sym_ind);

     

    for pusch_sym_no = 1:12

        phy_sym_freq_data = ifft(resourceGridUL(pusch_sym_ind_matrix(:,pusch_sym_no)));

        

        subplot(12,6,6*(pusch_sym_no-1) + 1);

        plot(real(phy_sym_freq_data),imag(phy_sym_freq_data),'ro','MarkerFaceColor',[1 0 0]);

        axis([-0.2 0.2 -0.2 0.2]);

        set(gca,'xticklabel',[]); set(gca,'yticklabel',[]);

        set(gca,'xtick',[]);set(gca,'ytick',[]);

     

        subplot(12,6,[(6*(pusch_sym_no-1) + 2) : (6*(pusch_sym_no-1) + 6)]);

        plot(plot_sym_range,real(phy_sym_freq_data),'ro-',...

             plot_sym_range,imag(phy_sym_freq_data),'bo-');

        xlim([0 max(plot_sym_range)]);

        set(gca,'xticklabel',[]); set(gca,'yticklabel',[]);

        set(gca,'xtick',[]);set(gca,'ytick',[]);

    end;

      ue1.NCellID = 0;

      ue1.NSubframe = 0;

      ue1.NULRB = 6;

      ue1.Shortened = 0;

      ue1.NTxAnts = 1;

       

      pusch.PRBSet = (0:5).';

      pusch.Modulation = 'QPSK';

      pusch.RV = 0;

      pusch.DynCyclicShift = 0;

     

 

 

< Symbol to RE Mapping >

 

    ue1.NCellID = 0;

    ue1.CyclicPrefixUL = 'Normal';

    ue1.NSubframe = 0;

    ue1.Hopping = 'Off';

    ue1.NULRB = 6;

    ue1.Shortened = 0;

    ue1.NTxAnts = 1;

    ue1.SeqGroup = 0;

    ue1.CyclicShift = 0;

    ue1.RNTI = 1;

     

    pusch.PRBSet = (0:4).';

    pusch.Modulation = 'QPSK';

    pusch.RV = 0;

    pusch.DynCyclicShift = 0;

    pusch.NLayers = 1;

    pusch.OrthCover = 'Off';

     

    pusch_dmrs_sym = ltePUSCHDRS(ue1,pusch);

    pusch_dmrs_sym_arrayIndex = 0:length(pusch_dmrs_sym)-1;

    pusch_dmrs_sym_ind = ltePUSCHDRSIndices(ue1,pusch);

     

    pusch_trblk = round(rand(1,504));

    pusch_cw = lteULSCH(ue1,pusch,pusch_trblk);

    pusch_sym = ltePUSCH(ue1,pusch,pusch_cw);

    pusch_sym_arrayIndex = 0:length(pusch_sym)-1;

    pusch_sym_ind = ltePUSCHIndices(ue1,pusch);

     

    resourceGridUL = lteULResourceGrid(ue1);

     

    pusch_scale = 0.5;

    pusch_dmrs_scale = 1.0;

     

    resourceGridUL(pusch_dmrs_sym_ind) = pusch_dmrs_scale; % * pusch_dmrs_sym;

    resourceGridUL(pusch_sym_ind) = pusch_scale; % * pusch_sym;

     

    resourceGridUL = [ resourceGridUL resourceGridUL(:,13)];

    resourceGridUL = [ resourceGridUL; resourceGridUL((ue1.NULRB*12-1),:) ];

     

    xStep = 0:14;

    yStep = 0:(ue1.NULRB*12);

    surface(xStep,yStep,abs(resourceGridUL));

    axis([0 14 0 (ue1.NULRB*12) 0 2]);

    view([0,90]);

    set(gca,'xtick',[0 6 7 13]);

    set(gca,'ytick',[[0:12:ue1.NULRB*12-1] [ue1.NULRB*12-1]]);

    ue1.NCellID = 0;

    ue1.NSubframe = 0;

    ue1.NULRB = 6;

    ue1.Shortened = 0;

    ue1.NTxAnts = 1;

     

    pusch.PRBSet = (0:4).';

    pusch.Modulation = 'QPSK';

    pusch.RV = 0;

    pusch.DynCyclicShift = 0;

    ue1.NCellID = 0;

    ue1.NSubframe = 0;

    ue1.NULRB = 25;

    ue1.Shortened = 0;

    ue1.NTxAnts = 1;

     

    pusch.PRBSet = (0:4).';

    pusch.Modulation = 'QPSK';

    pusch.RV = 0;

    pusch.DynCyclicShift = 0;

 

    ue1.NCellID = 0;

    ue1.NSubframe = 0;

    ue1.NULRB = 6;

    ue1.Shortened = 1;

    ue1.NTxAnts = 1;

     

    pusch.PRBSet = (0:4).';

    pusch.Modulation = 'QPSK';

    pusch.RV = 0;

    pusch.DynCyclicShift = 0;

    ue1.NCellID = 0;

    ue1.NSubframe = 0;

    ue1.NULRB = 25;

    ue1.Shortened = 1;

    ue1.NTxAnts = 1;

     

    pusch.PRBSet = (0:4).';

    pusch.Modulation = 'QPSK';

    pusch.RV = 0;

    pusch.DynCyclicShift = 0;

 

 

 

 

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.