Matlab Toolbox - 5G/NR

 

 

 

 

Uplink Frame Structure 

 

NOTE :  It is required to have Matlab 5G Toolbox  to run this script. Matlab Version that I used for this page is 2019a v9.6, 5G Toolbox v1.1

 

I created the tutorial code on this page with the help of Matlab 5G Toolbox tutorial here.

Followings are the list of configurations that I tried on this page. I tried to make it as practical as possible based on 3GPP higher layer specification.

 

 

 

PUSCH DMRS

 

parameter \ slot number(n)

0

1

2

3

4

5

6

7

8

9

pusch(n).NLayers

1

1

1

1

1

pusch(n).NAntennaPorts

1

1

1

1

1

pusch(n).IntraSlotFreqHopping

disabled

disabled

disabled

disabled

disabled

pusch(n).RBOffset

10

10

10

10

10

pusch(n).InterSlotFreqHopping

disabled

disabled

disabled

disabled

disabled

SLIV

41

41

41

41

41

pusch(n).PortSet

0

0

0

0

0

pusch(n).PUSCHMappingType

A

A

A

A

A

pusch(n).DMRSTypeAPosition

2

3

2

3

2

pusch(n).DMRSLength

1

1

2

2

1

pusch(n).DMRSAdditionalPosition

0

0

0

0

0

pusch(n).DMRSConfigurationType

1

1

1

1

2

pusch(n).AllocatedSymbols

0:12

0:12

0:12

0:12

0:12

pusch(n).AllocatedPRB

0:10

0:10

0:10

0:10

0:10

 

 

 

 

parameter \ slot number(n)

0

1

2

3

4

5

6

7

8

9

pusch(n).NLayers

1

1

1

1

1

pusch(n).NAntennaPorts

1

1

1

1

1

pusch(n).IntraSlotFreqHopping

disabled

disabled

disabled

disabled

disabled

pusch(n).RBOffset

10

10

10

10

10

pusch(n).InterSlotFreqHopping

disabled

disabled

disabled

disabled

disabled

SLIV

41

41

41

41

41

pusch(n).PortSet

0

0

0

0

0

pusch(n).PUSCHMappingType

A

A

A

A

A

pusch(n).DMRSTypeAPosition

2

2

2

3

3

pusch(n).DMRSLength

2

1

1

1

1

pusch(n).DMRSAdditionalPosition

0

1

2

1

2

pusch(n).DMRSConfigurationType

2

1

1

1

1

pusch(n).AllocatedSymbols

0:12

0:12

0:12

0:12

0:12

pusch(n).AllocatedPRB

0:10

0:10

0:10

0:10

0:10

 

 

 

 

parameter \ slot number(n)

0

1

2

3

4

5

6

7

8

9

pusch(n).NLayers

1

1

1

1

1

pusch(n).NAntennaPorts

1

1

1

1

1

pusch(n).IntraSlotFreqHopping

disabled

disabled

disabled

disabled

disabled

pusch(n).RBOffset

10

10

10

10

10

pusch(n).InterSlotFreqHopping

disabled

disabled

disabled

disabled

disabled

SLIV

41

41

41

41

41

pusch(n).PortSet

0

0

0

0

0

pusch(n).PUSCHMappingType

A

A

A

A

A

pusch(n).DMRSTypeAPosition

2

2

2

3

3

pusch(n).DMRSLength

2

1

1

1

2

pusch(n).DMRSAdditionalPosition

1

1

2

2

1

pusch(n).DMRSConfigurationType

1

2

2

2

2

pusch(n).AllocatedSymbols

0:12

0:12

0:12

0:12

0:12

pusch(n).AllocatedPRB

0:10

0:10

0:10

0:10

0:10

 

 

 

PUSCH Frequency Hopping

 

parameter \ slot number(n)

0

1

2

3

4

5

6

7

8

9

pusch(n).NLayers

1

1

1

1

1

pusch(n).NAntennaPorts

1

1

1

1

1

pusch(n).IntraSlotFreqHopping

disabled

disabled

disabled

disabled

disabled

pusch(n).RBOffset

5

10

20

50

80

pusch(n).InterSlotFreqHopping

enabled

enabled

enabled

enabled

enabled

SLIV

41

41

41

41

41

pusch(n).PortSet

0

0

0

0

0

pusch(n).PUSCHMappingType

A

A

A

A

A

pusch(n).DMRSTypeAPosition

2

2

2

3

3

pusch(n).DMRSLength

1

1

1

1

1

pusch(n).DMRSAdditionalPosition

1

1

2

2

1

pusch(n).DMRSConfigurationType

1

2

2

2

2

pusch(n).AllocatedSymbols

0:12

0:12

0:12

0:12

0:12

pusch(n).AllocatedPRB

0:10

0:10

0:10

0:10

0:10

 

 

 

 

parameter \ slot number(n)

0

1

2

3

4

5

6

7

8

9

pusch(n).NLayers

1

1

1

1

1

pusch(n).NAntennaPorts

1

1

1

1

1

pusch(n).IntraSlotFreqHopping

enabled

enabled

enabled

enabled

enabled

pusch(n).RBOffset

5

10

20

50

80

pusch(n).InterSlotFreqHopping

disabled

disabled

disabled

disabled

disabled

SLIV

41

41

41

41

41

pusch(n).PortSet

0

0

0

0

0

pusch(n).PUSCHMappingType

A

A

A

A

A

pusch(n).DMRSTypeAPosition

2

2

2

2

2

pusch(n).DMRSLength

1

1

1

1

1

pusch(n).DMRSAdditionalPosition

0

0

0

0

0

pusch(n).DMRSConfigurationType

1

1

1

1

1

pusch(n).AllocatedSymbols

0:12

0:12

0:12

0:12

0:12

pusch(n).AllocatedPRB

0:10

0:10

0:10

0:10

0:10

 

 

 

 

parameter \ slot number(n)

0

1

2

3

4

5

6

7

8

9

pusch(n).NLayers

1

1

1

1

1

pusch(n).NAntennaPorts

1

1

1

1

1

pusch(n).IntraSlotFreqHopping

enabled

enabled

enabled

enabled

enabled

pusch(n).RBOffset

5

10

20

50

80

pusch(n).InterSlotFreqHopping

disabled

disabled

disabled

disabled

disabled

SLIV

41

41

41

41

41

pusch(n).PortSet

0

0

0

0

0

pusch(n).PUSCHMappingType

A

A

A

A

A

pusch(n).DMRSTypeAPosition

2

2

2

2

2

pusch(n).DMRSLength

1

1

1

1

1

pusch(n).DMRSAdditionalPosition

1

1

1

1

1

pusch(n).DMRSConfigurationType

1

1

1

1

1

pusch(n).AllocatedSymbols

0:12

0:12

0:12

0:12

0:12

pusch(n).AllocatedPRB

0:10

0:10

0:10

0:10

0:10

 

 

 

 

parameter \ slot number(n)

0

1

2

3

4

5

6

7

8

9

pusch(n).NLayers

1

1

1

1

1

pusch(n).NAntennaPorts

1

1

1

1

1

pusch(n).IntraSlotFreqHopping

enabled

enabled

enabled

enabled

enabled

pusch(n).RBOffset

1

10

20

50

80

pusch(n).InterSlotFreqHopping

disabled

disabled

disabled

disabled

disabled

SLIV

41

41

41

41

41

pusch(n).PortSet

0

0

0

0

0

pusch(n).PUSCHMappingType

A

A

A

A

A

pusch(n).DMRSTypeAPosition

2

2

2

2

2

pusch(n).DMRSLength

1

1

1

1

1

pusch(n).DMRSAdditionalPosition

1

1

1

1

1

pusch(n).DMRSConfigurationType

2

2

2

2

2

pusch(n).AllocatedSymbols

0:12

0:12

0:12

0:12

0:12

pusch(n).AllocatedPRB

0:10

0:10

0:10

0:10

0:10

 

 

 

 

PUCCH

 

< Format 0 : Ex01 >

parameter \ slot number(n)

0

1

2

3

4

5

6

7

8

9

pucch(n).PUCCHFormat

0

0

0

0

0

0

0

0

0

0

pucch(n).StartPRB

0

0

0

0

0

0

10

10

40

2

pucch(n).IntraSlotFreqHopping

disable

disable

enable

enable

enable

enable

enable

enable

enable

enable

pucch(n).SecondHopPRB

10

2

1

2

10

100

11

20

50

1

pucch(n).StartSymbol

12

12

12

12

12

12

12

12

12

12

pucch(n).NrOfSymbols

2

2

2

2

2

2

2

2

2

2

pucch(n).NrOfRB

9

9

9

9

9

9

9

9

9

9

pucch(n).AdditionalDMRS

1

1

1

1

1

1

1

1

1

1

pucch(n).InterSlotFreqHopping

disable

disable

disable

disable

disable

disable

disable

disable

disable

disable

pucch(n).LenACK

1

1

1

1

1

1

1

1

1

1

pucch(n).LenSR

0

0

0

0

0

0

0

0

0

0

 

 

 

< Format 1 : Ex01 >

parameter \ slot number(n)

0

1

2

3

4

5

6

7

8

9

pucch(n).PUCCHFormat

1

1

1

1

1

1

1

1

1

1

pucch(n).StartPRB

0

0

0

0

0

0

0

0

0

0

pucch(n).IntraSlotFreqHopping

disable

enable

disable

enable

disable

enable

disable

enable

disable

enable

pucch(n).SecondHopPRB

2

2

2

2

2

2

2

2

2

2

pucch(n).StartSymbol

10

10

9

9

8

8

7

7

6

6

pucch(n).NrOfSymbols

4

4

5

5

6

6

7

7

8

8

pucch(n).NrOfRB

9

9

9

9

9

9

9

9

9

9

pucch(n).AdditionalDMRS

0

0

0

0

0

0

0

0

0

0

pucch(n).InterSlotFreqHopping

disable

disable

disable

disable

disable

disable

disable

disable

disable

disable

pucch(n).LenACK

2

2

2

2

2

2

2

2

2

2

pucch(n).LenSR

0

0

0

0

0

0

0

0

0

0

 

 

 

< Format 1 : Ex02 >

parameter \ slot number(n)

0

1

2

3

4

5

6

7

8

9

pucch(n).PUCCHFormat

1

1

1

1

1

1

1

1

1

1

pucch(n).StartPRB

0

0

0

0

0

0

0

0

0

0

pucch(n).IntraSlotFreqHopping

disable

enable

disable

enable

disable

enable

disable

enable

disable

enable

pucch(n).SecondHopPRB

2

2

2

2

2

2

2

2

2

2

pucch(n).StartSymbol

5

5

4

4

2

2

1

1

0

0

pucch(n).NrOfSymbols

9

9

10

10

12

12

13

13

14

14

pucch(n).NrOfRB

9

9

9

9

9

9

9

9

9

9

pucch(n).AdditionalDMRS

0

0

0

0

0

0

0

0

0

0

pucch(n).InterSlotFreqHopping

disable

disable

disable

disable

disable

disable

disable

disable

disable

disable

pucch(n).LenACK

2

2

2

2

2

2

2

2

2

2

pucch(n).LenSR

0

0

0

0

0

0

0

0

0

0

 

 

 

< Format 2 : Ex 01 >

parameter \ slot number(n)

0

1

2

3

4

5

6

7

8

9

pucch(n).PUCCHFormat

2

2

2

2

2

2

2

2

2

2

pucch(n).StartPRB

0

0

0

0

0

0

0

0

0

0

pucch(n).IntraSlotFreqHopping

disable

disable

enable

disable

disable

enable

disable

disable

enable

enable

pucch(n).SecondHopPRB

2

2

2

40

40

40

60

60

60

2

pucch(n).StartSymbol

13

12

12

13

13

13

13

12

12

13

pucch(n).NrOfSymbols

1

2

2

1

2

2

1

2

2

2

pucch(n).NrOfRB

2

2

2

8

8

8

16

16

16

1

pucch(n).AdditionalDMRS

0

0

0

0

0

0

0

0

0

0

pucch(n).InterSlotFreqHopping

disable

disable

disable

disable

disable

disable

disable

disable

disable

disable

pucch(n).LenACK

3

3

3

3

3

3

3

3

3

3

pucch(n).LenSR

0

0

0

0

0

0

0

0

0

0

 

 

 

< Format 3 : Ex 01 >

parameter \ slot number(n)

0

1

2

3

4

5

6

7

8

9

pucch(n).PUCCHFormat

3

3

3

3

3

3

3

3

3

3

pucch(n).StartPRB

0

0

0

0

0

0

0

0

0

0

pucch(n).IntraSlotFreqHopping

disable

enable

disable

enable

disable

enable

disable

enable

disable

enable

pucch(n).SecondHopPRB

1

1

16

16

16

16

16

16

16

16

pucch(n).StartSymbol

10

10

10

10

9

9

8

8

7

7

pucch(n).NrOfSymbols

4

4

4

4

5

5

6

6

7

7

pucch(n).NrOfRB

1

1

16

16

16

16

16

16

16

16

pucch(n).AdditionalDMRS

0

0

0

0

0

0

0

0

0

0

pucch(n).InterSlotFreqHopping

disable

disable

disable

disable

disable

disable

disable

disable

disable

disable

pucch(n).LenACK

3

3

3

3

3

3

3

3

3

3

pucch(n).LenSR

0

0

0

0

0

0

0

0

0

0

 

 

 

< Format 3 : Ex02 >

parameter \ slot number(n)

0

1

2

3

4

5

6

7

8

9

pucch(n).PUCCHFormat

3

3

3

3

3

3

3

3

3

3

pucch(n).StartPRB

0

0

0

0

0

0

0

0

0

0

pucch(n).IntraSlotFreqHopping

disable

enable

disable

enable

disable

enable

disable

enable

disable

enable

pucch(n).SecondHopPRB

16

16

16

16

16

16

16

16

16

16

pucch(n).StartSymbol

6

6

5

5

4

4

4

4

3

3

pucch(n).NrOfSymbols

8

8

9

9

10

10

10

10

11

11

pucch(n).NrOfRB

16

16

16

16

16

16

16

16

16

16

pucch(n).AdditionalDMRS

0

0

0

0

0

0

0

1

1

0

pucch(n).InterSlotFreqHopping

disable

disable

disable

disable

disable

disable

disable

disable

disable

disable

pucch(n).LenACK

3

3

3

3

3

3

3

3

3

3

pucch(n).LenSR

0

0

0

0

0

0

0

0

0

0

 

 

 

< Format 3 : Ex03 >

parameter \ slot number(n)

0

1

2

3

4

5

6

7

8

9

pucch(n).PUCCHFormat

3

3

3

3

3

3

3

3

3

3

pucch(n).StartPRB

0

0

0

0

0

0

0

0

0

0

pucch(n).IntraSlotFreqHopping

disable

enable

disable

enable

disable

enable

disable

enable

disable

enable

pucch(n).SecondHopPRB

16

16

16

16

16

16

16

16

16

16

pucch(n).StartSymbol

3

3

2

2

2

2

1

1

1

1

pucch(n).NrOfSymbols

11

11

12

12

12

12

13

13

13

13

pucch(n).NrOfRB

16

16

16

16

16

16

16

16

16

16

pucch(n).AdditionalDMRS

1

1

0

0

1

1

0

0

1

1

pucch(n).InterSlotFreqHopping

disable

disable

disable

disable

disable

disable

disable

disable

disable

disable

pucch(n).LenACK

3

3

3

3

3

3

3

3

3

3

pucch(n).LenSR

0

0

0

0

0

0

0

0

0

0

 

 

 

< Format 3 : Ex04 >

parameter \ slot number(n)

0

1

2

3

4

5

6

7

8

9

pucch(n).PUCCHFormat

3

3

3

3

3

 

3

     

pucch(n).StartPRB

0

16

0

16

0

 

0

     

pucch(n).IntraSlotFreqHopping

disable

enable

disable

enable

disable

 

disable

     

pucch(n).SecondHopPRB

16

32

16

32

16

 

16

     

pucch(n).StartSymbol

0

0

0

0

0

 

0

     

pucch(n).NrOfSymbols

14

14

14

14

14

 

14

     

pucch(n).NrOfRB

16

16

16

16

14

 

16

     

pucch(n).AdditionalDMRS

0

0

1

1

0

 

0

     

pucch(n).InterSlotFreqHopping

disable

disable

disable

disable

enable

 

enable

     

pucch(n).LenACK

3

3

3

3

3

 

3

     

pucch(n).LenSR

0

0

0

0

0

 

0

     

pucch(n).nrOfSlots

1

1

1

1

2

 

4

     

 

 

 

< Format 4 : Ex01 >

parameter \ slot number(n)

0

1

2

3

4

5

6

7

8

9

pucch(n).PUCCHFormat

4

4

4

4

4

4

4

4

4

4

pucch(n).StartPRB

0

0

0

0

0

0

0

0

0

0

pucch(n).IntraSlotFreqHopping

disable

enable

disable

enable

disable

enable

disable

enable

disable

enable

pucch(n).SecondHopPRB

1

1

1

1

1

1

1

1

1

1

pucch(n).StartSymbol

10

10

9

9

8

8

7

7

6

6

pucch(n).NrOfSymbols

4

4

5

5

6

6

7

7

8

8

pucch(n).NrOfRB

N/A

N/A

N/A

N/A

N/A

N/A

N/A

N/A

N/A

N/A

pucch(n).AdditionalDMRS

0

0

0

0

1

1

0

0

1

1

pucch(n).InterSlotFreqHopping

disable

disable

disable

disable

disable

disable

disable

disable

disable

disable

pucch(n).LenACK

3

3

3

3

3

3

3

3

3

3

pucch(n).LenSR

0

0

0

0

0

0

0

0

0

0

pucch(n).nrOfSlots

1

1

1

1

1

1

1

1

1

1

 

 

 

< Format 4 : Ex02 >

parameter \ slot number(n)

0

1

2

3

4

5

6

7

8

9

pucch(n).PUCCHFormat

4

4

4

4

4

4

4

4

4

4

pucch(n).StartPRB

0

0

0

0

0

0

0

0

0

0

pucch(n).IntraSlotFreqHopping

disable

enable

disable

enable

disable

enable

disable

enable

disable

enable

pucch(n).SecondHopPRB

1

1

1

1

1

1

1

1

1

1

pucch(n).StartSymbol

5

5

4

4

4

4

3

3

3

3

pucch(n).NrOfSymbols

9

9

10

10

10

10

11

11

11

11

pucch(n).NrOfRB

N/A

N/A

N/A

N/A

N/A

N/A

N/A

N/A

N/A

N/A

pucch(n).AdditionalDMRS

0

0

0

0

1

1

0

0

1

1

pucch(n).InterSlotFreqHopping

disable

disable

disable

disable

disable

disable

disable

disable

disable

disable

pucch(n).LenACK

3

3

3

3

3

3

3

3

3

3

pucch(n).LenSR

0

0

0

0

0

0

0

0

0

0

pucch(n).nrOfSlots

1

1

1

1

1

1

1

1

1

1

 

 

 

< Format 4 : Ex03 >

parameter \ slot number(n)

0

1

2

3

4

5

6

7

8

9

pucch(n).PUCCHFormat

4

4

4

4

4

4

4

4

4

4

pucch(n).StartPRB

0

0

0

0

0

0

0

0

0

1

pucch(n).IntraSlotFreqHopping

disable

enable

disable

enable

disable

enable

disable

enable

disable

enable

pucch(n).SecondHopPRB

1

1

1

1

1

1

1

1

1

2

pucch(n).StartSymbol

2

2

2

2

1

1

1

1

0

0

pucch(n).NrOfSymbols

12

12

12

12

13

13

13

13

14

14

pucch(n).NrOfRB

N/A

N/A

N/A

N/A

N/A

N/A

N/A

N/A

N/A

N/A

pucch(n).AdditionalDMRS

0

0

1

1

0

0

1

1

0

0

pucch(n).InterSlotFreqHopping

disable

disable

disable

disable

disable

disable

disable

disable

disable

disable

pucch(n).LenACK

3

3

3

3

3

3

3

3

3

3

pucch(n).LenSR

0

0

0

0

0

0

0

0

0

0

pucch(n).nrOfSlots

1

1

1

1

1

1

1

1

1

1

 

 

 

< Format 4 : Ex04 >

parameter \ slot number(n)

0

1

2

3

4

5

6

7

8

9

pucch(n).PUCCHFormat

4

4

4

 

4

         

pucch(n).StartPRB

0

0

0

 

2

         

pucch(n).IntraSlotFreqHopping

disable

enable

disable

 

disable

         

pucch(n).SecondHopPRB

1

1

1

 

1

         

pucch(n).StartSymbol

0

0

1

 

1

         

pucch(n).NrOfSymbols

14

14

13

 

13

         

pucch(n).NrOfRB

N/A

N/A

N/A

 

N/A

         

pucch(n).AdditionalDMRS

1

1

0

 

1

         

pucch(n).InterSlotFreqHopping

disable

disable

ensable

 

ensable

         

pucch(n).LenACK

3

3

3

 

3

         

pucch(n).LenSR

0

0

0

 

0

         

pucch(n).nrOfSlots

1

1

2

 

4

         

 

 

 

 

Source Code

 

5G_FrameStructure_UL.m

waveconfig = [];

waveconfig.NCellID = 0;            

waveconfig.ChannelBandwidth = 40;  

waveconfig.FrequencyRange = 'FR1';

waveconfig.NumSubframes = 5;      

 

waveconfig.DisplayGrids = 1;      

 

carriers = [];

carriers(1).SubcarrierSpacing = 30;

carriers(1).NRB = 106;

carriers(1).RBStart = 0;

 

bwp = [];

EnablePUSCH = 1

EnablePUCCH = 0

 

bwp(1).SubcarrierSpacing = 30;              

bwp(1).CyclicPrefix = 'Normal';            

bwp(1).NRB = 106;                           

bwp(1).RBOffset = 0;                      

 

pucch = [];

pucch(1).Enable = EnablePUCCH;                       

pucch(1).BWP = 1;                           

pucch(1).Power = 0;                         

pucch(1).AllocatedSlots = [0];            

pucch(1).AllocatedPeriod = 10;              

pucch(1).PowerDMRS = 1;                     

pucch(1).DedicatedResource = 1;             

pucch(1).ResourceIndex = 0;                 

pucch(1).StartPRB = 0;                      

pucch(1).SecondHopPRB = 10;                  

pucch(1).IntraSlotFreqHopping = 'enabled';  

pucch(1).GroupHopping = 'enable';            

pucch(1).PUCCHFormat = 3;                   

pucch(1).StartSymbol = 3;                  

pucch(1).NrOfSymbols = 11;                  

pucch(1).InitialCS = 3;                     

pucch(1).OCCI = 0;                          

pucch(1).Modulation = 'QPSK';               

pucch(1).NrOfRB = 9;                        

pucch(1).SpreadingFactor = 4;               

pucch(1).AdditionalDMRS = 1;               

pucch(1).RNTI = 0;                          

pucch(1).NID = 1;                           

pucch(1).HoppingId = 1;                     

pucch(1).NIDDMRS = 1;                       

pucch(1).NrOfSlots = 1;                    

pucch(1).InterSlotFreqHopping = 'disabled';

pucch(1).MaxCodeRate = 0.15;                

pucch(1).EnableCoding = 1;                  

pucch(1).LenACK = 4;                        

pucch(1).LenSR = 0;                        

pucch(1).LenCSI1 = 10;                      

pucch(1).LenCSI2 = 10;                      

pucch(1).DataSource = 'PN9';                

 

pucch(2).Enable = EnablePUCCH;                       

pucch(2).BWP = 1;                           

pucch(2).Power = 0;                         

pucch(2).AllocatedSlots = [1];            

pucch(2).AllocatedPeriod = 10;              

pucch(2).PowerDMRS = 1;                     

pucch(2).DedicatedResource = 1;             

pucch(2).ResourceIndex = 0;                 

pucch(2).StartPRB = 0;                      

pucch(2).SecondHopPRB = 10;                  

pucch(2).IntraSlotFreqHopping = 'enabled';  

pucch(2).GroupHopping = 'enable';            

pucch(2).PUCCHFormat = 3;                   

pucch(2).StartSymbol = 3;                  

pucch(2).NrOfSymbols = 11;                  

pucch(2).InitialCS = 3;                     

pucch(2).OCCI = 0;                          

pucch(2).Modulation = 'QPSK';               

pucch(2).NrOfRB = 9;                        

pucch(2).SpreadingFactor = 4;               

pucch(2).AdditionalDMRS = 1;               

pucch(2).RNTI = 1;                          

pucch(2).NID = 1;                           

pucch(2).HoppingId = 1;                     

pucch(2).NIDDMRS = 1;                       

pucch(2).NrOfSlots = 1;                    

pucch(2).InterSlotFreqHopping = 'disabled';

pucch(2).MaxCodeRate = 0.15;                

pucch(2).EnableCoding = 1;                  

pucch(2).LenACK = 4;                        

pucch(2).LenSR = 0;                        

pucch(2).LenCSI1 = 10;                      

pucch(2).LenCSI2 = 10;                      

pucch(2).DataSource = 'PN9';                

 

pucch(3).Enable = EnablePUCCH;                       

pucch(3).BWP = 1;                           

pucch(3).Power = 0;                         

pucch(3).AllocatedSlots = [2];            

pucch(3).AllocatedPeriod = 10;              

pucch(3).PowerDMRS = 1;                     

pucch(3).DedicatedResource = 1;             

pucch(3).ResourceIndex = 0;                 

pucch(3).StartPRB = 0;                      

pucch(3).SecondHopPRB = 10;                  

pucch(3).IntraSlotFreqHopping = 'enabled';  

pucch(3).GroupHopping = 'enable';            

pucch(3).PUCCHFormat = 3;                   

pucch(3).StartSymbol = 3;                  

pucch(3).NrOfSymbols = 11;                  

pucch(3).InitialCS = 3;                     

pucch(3).OCCI = 0;                          

pucch(3).Modulation = 'QPSK';               

pucch(3).NrOfRB = 9;                        

pucch(3).SpreadingFactor = 4;               

pucch(3).AdditionalDMRS = 1;               

pucch(3).RNTI = 2;                          

pucch(3).NID = 1;                           

pucch(3).HoppingId = 1;                     

pucch(3).NIDDMRS = 1;                       

pucch(3).NrOfSlots = 1;                    

pucch(3).InterSlotFreqHopping = 'disabled';

pucch(3).MaxCodeRate = 0.15;                

pucch(3).EnableCoding = 1;                  

pucch(3).LenACK = 4;                        

pucch(3).LenSR = 0;                        

pucch(3).LenCSI1 = 10;                      

pucch(3).LenCSI2 = 10;                      

pucch(3).DataSource = 'PN9';

 

pucch(4).Enable = EnablePUCCH;                       

pucch(4).BWP = 1;                           

pucch(4).Power = 0;                         

pucch(4).AllocatedSlots = [3];            

pucch(4).AllocatedPeriod = 10;              

pucch(4).PowerDMRS = 1;                     

pucch(4).DedicatedResource = 1;             

pucch(4).ResourceIndex = 0;                 

pucch(4).StartPRB = 0;                      

pucch(4).SecondHopPRB = 10;                  

pucch(4).IntraSlotFreqHopping = 'enabled';  

pucch(4).GroupHopping = 'enable';            

pucch(4).PUCCHFormat = 3;                   

pucch(4).StartSymbol = 3;                  

pucch(4).NrOfSymbols = 11;                  

pucch(4).InitialCS = 3;                     

pucch(4).OCCI = 0;                          

pucch(4).Modulation = 'QPSK';               

pucch(4).NrOfRB = 9;                        

pucch(4).SpreadingFactor = 4;               

pucch(4).AdditionalDMRS = 1;               

pucch(4).RNTI = 3;                          

pucch(4).NID = 1;                           

pucch(4).HoppingId = 1;                     

pucch(4).NIDDMRS = 1;                       

pucch(4).NrOfSlots = 1;                    

pucch(4).InterSlotFreqHopping = 'disabled';

pucch(4).MaxCodeRate = 0.15;                

pucch(4).EnableCoding = 1;                  

pucch(4).LenACK = 4;                        

pucch(4).LenSR = 0;                        

pucch(4).LenCSI1 = 10;                      

pucch(4).LenCSI2 = 10;                      

pucch(4).DataSource = 'PN9';                

 

pucch(5).Enable = EnablePUCCH;                       

pucch(5).BWP = 1;                           

pucch(5).Power = 0;                         

pucch(5).AllocatedSlots = [4];            

pucch(5).AllocatedPeriod = 10;              

pucch(5).PowerDMRS = 1;                     

pucch(5).DedicatedResource = 1;             

pucch(5).ResourceIndex = 0;                 

pucch(5).StartPRB = 0;                      

pucch(5).SecondHopPRB = 10;                  

pucch(5).IntraSlotFreqHopping = 'enabled';  

pucch(5).GroupHopping = 'enable';            

pucch(5).PUCCHFormat = 3;                   

pucch(5).StartSymbol = 3;                  

pucch(5).NrOfSymbols = 11;                  

pucch(5).InitialCS = 3;                     

pucch(5).OCCI = 0;                          

pucch(5).Modulation = 'QPSK';               

pucch(5).NrOfRB = 9;                        

pucch(5).SpreadingFactor = 4;               

pucch(5).AdditionalDMRS = 1;               

pucch(5).RNTI = 4;                          

pucch(5).NID = 1;                           

pucch(5).HoppingId = 1;                     

pucch(5).NIDDMRS = 1;                       

pucch(5).NrOfSlots = 1;                    

pucch(5).InterSlotFreqHopping = 'disabled';

pucch(5).MaxCodeRate = 0.15;                

pucch(5).EnableCoding = 1;                  

pucch(5).LenACK = 4;                        

pucch(5).LenSR = 0;                        

pucch(5).LenCSI1 = 10;                      

pucch(5).LenCSI2 = 10;                      

pucch(5).DataSource = 'PN9';                

 

pucch(6).Enable = EnablePUCCH;                       

pucch(6).BWP = 1;                           

pucch(6).Power = 0;                         

pucch(6).AllocatedSlots = [5];            

pucch(6).AllocatedPeriod = 10;              

pucch(6).PowerDMRS = 1;                     

pucch(6).DedicatedResource = 1;             

pucch(6).ResourceIndex = 0;                 

pucch(6).StartPRB = 0;                      

pucch(6).SecondHopPRB = 10;                  

pucch(6).IntraSlotFreqHopping = 'enabled';  

pucch(6).GroupHopping = 'enable';            

pucch(6).PUCCHFormat = 3;                   

pucch(6).StartSymbol = 3;                  

pucch(6).NrOfSymbols = 11;                  

pucch(6).InitialCS = 3;                     

pucch(6).OCCI = 0;                          

pucch(6).Modulation = 'QPSK';               

pucch(6).NrOfRB = 9;                        

pucch(6).SpreadingFactor = 4;               

pucch(6).AdditionalDMRS = 1;               

pucch(6).RNTI = 5;                          

pucch(6).NID = 1;                           

pucch(6).HoppingId = 1;                     

pucch(6).NIDDMRS = 1;                       

pucch(6).NrOfSlots = 1;                    

pucch(6).InterSlotFreqHopping = 'disabled';

pucch(6).MaxCodeRate = 0.15;                

pucch(6).EnableCoding = 1;                  

pucch(6).LenACK = 4;                        

pucch(6).LenSR = 0;                        

pucch(6).LenCSI1 = 10;                      

pucch(6).LenCSI2 = 10;                      

pucch(6).DataSource = 'PN9';                

 

pucch(7).Enable = EnablePUCCH;                       

pucch(7).BWP = 1;                           

pucch(7).Power = 0;                         

pucch(7).AllocatedSlots = [6];            

pucch(7).AllocatedPeriod = 10;              

pucch(7).PowerDMRS = 1;                     

pucch(7).DedicatedResource = 1;             

pucch(7).ResourceIndex = 0;                 

pucch(7).StartPRB = 0;                      

pucch(7).SecondHopPRB = 10;                  

pucch(7).IntraSlotFreqHopping = 'enabled';  

pucch(7).GroupHopping = 'enable';            

pucch(7).PUCCHFormat = 3;                   

pucch(7).StartSymbol = 3;                  

pucch(7).NrOfSymbols = 11;                  

pucch(7).InitialCS = 3;                     

pucch(7).OCCI = 0;                          

pucch(7).Modulation = 'QPSK';               

pucch(7).NrOfRB = 9;                        

pucch(7).SpreadingFactor = 4;               

pucch(7).AdditionalDMRS = 1;               

pucch(7).RNTI = 6;                          

pucch(7).NID = 1;                           

pucch(7).HoppingId = 1;                     

pucch(7).NIDDMRS = 1;                       

pucch(7).NrOfSlots = 1;                    

pucch(7).InterSlotFreqHopping = 'disabled';

pucch(7).MaxCodeRate = 0.15;                

pucch(7).EnableCoding = 1;                  

pucch(7).LenACK = 4;                        

pucch(7).LenSR = 0;                        

pucch(7).LenCSI1 = 10;                      

pucch(7).LenCSI2 = 10;                      

pucch(7).DataSource = 'PN9';      

 

pucch(8).Enable = EnablePUCCH;                       

pucch(8).BWP = 1;                           

pucch(8).Power = 0;                         

pucch(8).AllocatedSlots = [7];            

pucch(8).AllocatedPeriod = 10;              

pucch(8).PowerDMRS = 1;                     

pucch(8).DedicatedResource = 1;             

pucch(8).ResourceIndex = 0;                 

pucch(8).StartPRB = 0;                      

pucch(8).SecondHopPRB = 10;                  

pucch(8).IntraSlotFreqHopping = 'enabled';  

pucch(8).GroupHopping = 'enable';            

pucch(8).PUCCHFormat = 3;                   

pucch(8).StartSymbol = 3;                  

pucch(8).NrOfSymbols = 11;                  

pucch(8).InitialCS = 3;                     

pucch(8).OCCI = 0;                          

pucch(8).Modulation = 'QPSK';               

pucch(8).NrOfRB = 9;                        

pucch(8).SpreadingFactor = 4;               

pucch(8).AdditionalDMRS = 1;               

pucch(8).RNTI = 7;                          

pucch(8).NID = 1;                           

pucch(8).HoppingId = 1;                     

pucch(8).NIDDMRS = 1;                       

pucch(8).NrOfSlots = 1;                    

pucch(8).InterSlotFreqHopping = 'disabled';

pucch(8).MaxCodeRate = 0.15;                

pucch(8).EnableCoding = 1;                  

pucch(8).LenACK = 4;                        

pucch(8).LenSR = 0;                        

pucch(8).LenCSI1 = 10;                      

pucch(8).LenCSI2 = 10;                      

pucch(8).DataSource = 'PN9';                

 

pucch(9).Enable = EnablePUCCH;                       

pucch(9).BWP = 1;                           

pucch(9).Power = 0;                         

pucch(9).AllocatedSlots = [8];            

pucch(9).AllocatedPeriod = 10;              

pucch(9).PowerDMRS = 1;                     

pucch(9).DedicatedResource = 1;             

pucch(9).ResourceIndex = 0;                 

pucch(9).StartPRB = 0;                      

pucch(9).SecondHopPRB = 10;                  

pucch(9).IntraSlotFreqHopping = 'enabled';  

pucch(9).GroupHopping = 'enable';            

pucch(9).PUCCHFormat = 3;                   

pucch(9).StartSymbol = 3;                  

pucch(9).NrOfSymbols = 11;                  

pucch(9).InitialCS = 3;                     

pucch(9).OCCI = 0;                          

pucch(9).Modulation = 'QPSK';               

pucch(9).NrOfRB = 9;                        

pucch(9).SpreadingFactor = 4;               

pucch(9).AdditionalDMRS = 1;               

pucch(9).RNTI = 8;                          

pucch(9).NID = 1;                           

pucch(9).HoppingId = 1;                     

pucch(9).NIDDMRS = 1;                       

pucch(9).NrOfSlots = 1;                    

pucch(9).InterSlotFreqHopping = 'disabled';

pucch(9).MaxCodeRate = 0.15;                

pucch(9).EnableCoding = 1;                  

pucch(9).LenACK = 4;                        

pucch(9).LenSR = 0;                        

pucch(9).LenCSI1 = 10;                      

pucch(9).LenCSI2 = 10;                      

pucch(9).DataSource = 'PN9';                

 

pucch(10).Enable = EnablePUCCH;                       

pucch(10).BWP = 1;                           

pucch(10).Power = 0;                         

pucch(10).AllocatedSlots = [9];            

pucch(10).AllocatedPeriod = 10;              

pucch(10).PowerDMRS = 1;                     

pucch(10).DedicatedResource = 1;             

pucch(10).ResourceIndex = 0;                 

pucch(10).StartPRB = 0;                      

pucch(10).SecondHopPRB = 10;                  

pucch(10).IntraSlotFreqHopping = 'enabled';  

pucch(10).GroupHopping = 'enable';            

pucch(10).PUCCHFormat = 3;                   

pucch(10).StartSymbol = 3;                  

pucch(10).NrOfSymbols = 11;                  

pucch(10).InitialCS = 3;                     

pucch(10).OCCI = 0;                          

pucch(10).Modulation = 'QPSK';               

pucch(10).NrOfRB = 9;                        

pucch(10).SpreadingFactor = 4;               

pucch(10).AdditionalDMRS = 1;               

pucch(10).RNTI = 9;                          

pucch(10).NID = 1;                           

pucch(10).HoppingId = 1;                     

pucch(10).NIDDMRS = 1;                       

pucch(10).NrOfSlots = 1;                    

pucch(10).InterSlotFreqHopping = 'disabled';

pucch(10).MaxCodeRate = 0.15;                

pucch(10).EnableCoding = 1;                  

pucch(10).LenACK = 4;                        

pucch(10).LenSR = 0;                        

pucch(10).LenCSI1 = 10;                      

pucch(10).LenCSI2 = 10;                      

pucch(10).DataSource = 'PN9';                

 

 

pusch = [];

pusch(1).Enable = 1;                        

pusch(1).BWP = 1;                           

pusch(1).Power = 0;                         

pusch(1).EnableCoding = 1;                  

pusch(1).NID = 1;                           

pusch(1).RNTI = 0;                          

pusch(1).TransformPrecoding = 0;            

pusch(1).TargetCodeRate = 0.47;             

pusch(1).Xoh_PUSCH = 0;                     

pusch(1).TxScheme = 'codebook';             

pusch(1).Modulation = 'QPSK';               

pusch(1).NLayers = 1;                       

pusch(1).NAntennaPorts = 1;                 

pusch(1).TPMI = 0;                          

pusch(1).RVSequence = [0 2 3 1];            

pusch(1).IntraSlotFreqHopping = 'disabled';

pusch(1).RBOffset = 10;                    

pusch(1).InterSlotFreqHopping = 'disabled';  

pusch(1).DataSource = 'PN9';               

pusch(1).PUSCHMappingType = 'A';        

pusch(1).AllocatedSymbols = 0:12;       

pusch(1).AllocatedSlots = [0 1];        

pusch(1).AllocatedPeriod = 10;           

pusch(1).AllocatedPRB = 0:10;          

pusch(1).DMRSConfigurationType = 1;    

pusch(1).NumCDMGroupsWithoutData = 2;  

pusch(1).PortSet = [0];              

pusch(1).DMRSTypeAPosition = 2;        

pusch(1).DMRSLength = 1;               

pusch(1).DMRSAdditionalPosition = 0;   

pusch(1).NIDNSCID = 1;                 

pusch(1).NSCID = 0;                    

pusch(1).NRSID = 0;                    

pusch(1).PowerDMRS = 0;                

pusch(1).GroupHopping = 'enable';      

pusch(1).DisableULSCH = 1;             

pusch(1).BetaOffsetACK = 1;           

pusch(1).BetaOffsetCSI1 = 2;           

pusch(1).BetaOffsetCSI2 = 2;           

pusch(1).ScalingFactor = 1;           

 

pusch(2).Enable = 1;                        

pusch(2).BWP = 1;                           

pusch(2).Power = 0;                         

pusch(2).EnableCoding = 1;                  

pusch(2).NID = 1;                           

pusch(2).RNTI = 1;                          

pusch(2).TransformPrecoding = 0;            

pusch(2).TargetCodeRate = 0.47;             

pusch(2).Xoh_PUSCH = 0;                     

pusch(2).TxScheme = 'codebook';             

pusch(2).Modulation = 'QPSK';               

pusch(2).NLayers = 1;                       

pusch(2).NAntennaPorts = 1;                 

pusch(2).TPMI = 0;                          

pusch(2).RVSequence = [0 2 3 1];            

pusch(2).IntraSlotFreqHopping = 'disabled';

pusch(2).RBOffset = 10;                    

pusch(2).InterSlotFreqHopping = 'disabled';  

pusch(2).DataSource = 'PN9';               

pusch(2).PUSCHMappingType = 'A';        

pusch(2).AllocatedSymbols = 0:12;       

pusch(2).AllocatedSlots = [2 3];        

pusch(2).AllocatedPeriod = 10;           

pusch(2).AllocatedPRB = 0:10;          

pusch(2).DMRSConfigurationType = 1;    

pusch(2).NumCDMGroupsWithoutData = 2;  

pusch(2).PortSet = [0];              

pusch(2).DMRSTypeAPosition = 3;        

pusch(2).DMRSLength = 1;               

pusch(2).DMRSAdditionalPosition = 0;   

pusch(2).NIDNSCID = 1;                 

pusch(2).NSCID = 0;                    

pusch(2).NRSID = 0;                    

pusch(2).PowerDMRS = 0;                

pusch(2).GroupHopping = 'enable';      

pusch(2).DisableULSCH = 1;             

pusch(2).BetaOffsetACK = 1;           

pusch(2).BetaOffsetCSI1 = 2;           

pusch(2).BetaOffsetCSI2 = 2;           

pusch(2).ScalingFactor = 1;           

 

pusch(3).Enable = 1;                        

pusch(3).BWP = 1;                           

pusch(3).Power = 0;                         

pusch(3).EnableCoding = 1;                  

pusch(3).NID = 1;                           

pusch(3).RNTI = 2;                          

pusch(3).TransformPrecoding = 0;            

pusch(3).TargetCodeRate = 0.47;             

pusch(3).Xoh_PUSCH = 0;                     

pusch(3).TxScheme = 'codebook';             

pusch(3).Modulation = 'QPSK';               

pusch(3).NLayers = 1;                       

pusch(3).NAntennaPorts = 1;                 

pusch(3).TPMI = 0;                          

pusch(3).RVSequence = [0 2 3 1];            

pusch(3).IntraSlotFreqHopping = 'disabled';

pusch(3).RBOffset = 10;                    

pusch(3).InterSlotFreqHopping = 'disabled';  

pusch(3).DataSource = 'PN9';               

pusch(3).PUSCHMappingType = 'A';        

pusch(3).AllocatedSymbols = 0:12;       

pusch(3).AllocatedSlots = [4 5];        

pusch(3).AllocatedPeriod = 10;           

pusch(3).AllocatedPRB = 0:10;          

pusch(3).DMRSConfigurationType = 1;    

pusch(3).NumCDMGroupsWithoutData = 2;  

pusch(3).PortSet = [0];              

pusch(3).DMRSTypeAPosition = 2;        

pusch(3).DMRSLength = 2;               

pusch(3).DMRSAdditionalPosition = 0;   

pusch(3).NIDNSCID = 1;                 

pusch(3).NSCID = 0;                    

pusch(3).NRSID = 0;                    

pusch(3).PowerDMRS = 0;                

pusch(3).GroupHopping = 'enable';      

pusch(3).DisableULSCH = 1;             

pusch(3).BetaOffsetACK = 1;           

pusch(3).BetaOffsetCSI1 = 2;           

pusch(3).BetaOffsetCSI2 = 2;           

pusch(3).ScalingFactor = 1;           

 

 

pusch(4).Enable = 1;                        

pusch(4).BWP = 1;                           

pusch(4).Power = 0;                         

pusch(4).EnableCoding = 1;                  

pusch(4).NID = 1;                           

pusch(4).RNTI = 3;                          

pusch(4).TransformPrecoding = 0;            

pusch(4).TargetCodeRate = 0.47;             

pusch(4).Xoh_PUSCH = 0;                     

pusch(4).TxScheme = 'codebook';             

pusch(4).Modulation = 'QPSK';               

pusch(4).NLayers = 1;                       

pusch(4).NAntennaPorts = 1;                 

pusch(4).TPMI = 0;                          

pusch(4).RVSequence = [0 2 3 1];            

pusch(4).IntraSlotFreqHopping = 'disabled';

pusch(4).RBOffset = 10;                    

pusch(4).InterSlotFreqHopping = 'disabled';  

pusch(4).DataSource = 'PN9';               

pusch(4).PUSCHMappingType = 'A';        

pusch(4).AllocatedSymbols = 0:12;       

pusch(4).AllocatedSlots = [6 7];        

pusch(4).AllocatedPeriod = 10;           

pusch(4).AllocatedPRB = 0:10;          

pusch(4).DMRSConfigurationType = 1;    

pusch(4).NumCDMGroupsWithoutData = 2;  

pusch(4).PortSet = [0];              

pusch(4).DMRSTypeAPosition = 3;        

pusch(4).DMRSLength = 2;               

pusch(4).DMRSAdditionalPosition = 0;   

pusch(4).NIDNSCID = 1;                 

pusch(4).NSCID = 0;                    

pusch(4).NRSID = 0;                    

pusch(4).PowerDMRS = 0;                

pusch(4).GroupHopping = 'enable';      

pusch(4).DisableULSCH = 1;             

pusch(4).BetaOffsetACK = 1;           

pusch(4).BetaOffsetCSI1 = 2;           

pusch(4).BetaOffsetCSI2 = 2;           

pusch(4).ScalingFactor = 1;           

 

pusch(5).Enable = 1;                        

pusch(5).BWP = 1;                           

pusch(5).Power = 0;                         

pusch(5).EnableCoding = 1;                  

pusch(5).NID = 1;                           

pusch(5).RNTI = 4;                          

pusch(5).TransformPrecoding = 0;            

pusch(5).TargetCodeRate = 0.47;             

pusch(5).Xoh_PUSCH = 0;                     

pusch(5).TxScheme = 'codebook';             

pusch(5).Modulation = 'QPSK';               

pusch(5).NLayers = 1;                       

pusch(5).NAntennaPorts = 1;                 

pusch(5).TPMI = 0;                          

pusch(5).RVSequence = [0 2 3 1];            

pusch(5).IntraSlotFreqHopping = 'disabled';

pusch(5).RBOffset = 10;                    

pusch(5).InterSlotFreqHopping = 'disabled';  

pusch(5).DataSource = 'PN9';               

pusch(5).PUSCHMappingType = 'A';        

pusch(5).AllocatedSymbols = 0:12;       

pusch(5).AllocatedSlots = [8 9];        

pusch(5).AllocatedPeriod = 10;           

pusch(5).AllocatedPRB = 0:10;          

pusch(5).DMRSConfigurationType = 2;    

pusch(5).NumCDMGroupsWithoutData = 2;  

pusch(5).PortSet = [0];              

pusch(5).DMRSTypeAPosition = 2;        

pusch(5).DMRSLength = 1;               

pusch(5).DMRSAdditionalPosition = 0;   

pusch(5).NIDNSCID = 1;                 

pusch(5).NSCID = 0;                    

pusch(5).NRSID = 0;                    

pusch(5).PowerDMRS = 0;                

pusch(5).GroupHopping = 'enable';      

pusch(5).DisableULSCH = 1;             

pusch(5).BetaOffsetACK = 1;           

pusch(5).BetaOffsetCSI1 = 2;           

pusch(5).BetaOffsetCSI2 = 2;           

pusch(5).ScalingFactor = 1;           

 

waveconfig.Carriers = carriers;

waveconfig.BWP = bwp;

waveconfig.PUCCH = pucch;

waveconfig.PUSCH = pusch;

 

% Generate complex baseband waveform

[waveform,bwpset] = ShowGridUL(waveconfig,[300 400 800 600]);

[waveform,bwpset] = ShowGridUL(waveconfig,[300 80 800 300],[0 140 0 4*12]);

 

disp('Information associated to BWP 1:')

disp(bwpset(1).Info)