Main Content

nrWaveformGenerator

Generate 5G NR waveform

Since R2020b

Description

example

[wave,info] = nrWaveformGenerator(cfg) generates 5G NR waveform wave for specified configuration cfg. The input cfg specifies either downlink or uplink configuration parameters for single or multiple subcarrier spacing (SCS) carriers and bandwidth parts (BWPs).

  • If cfg is an nrDLCarrierConfig object, the configuration also specifies the synchronization signal (SS) burst, control resource sets (CORESETs), search spaces, physical downlink control channels (PDCCH) and associated demodulation reference signals (DM-RS), physical downlink shared channels (PDSCH) and associated DM-RS and phase tracking reference signals (PT-RS), and channel-state information reference signals (CSI-RS).

  • If cfg is an nrULCarrierConfig object, the configuration also specifies the physical uplink shared channels (PUSCH) and associated DM-RS and PT-RS, the physical uplink control channels (PUCCH) and associated DM-RS, and the sounding reference signals (SRS).

The function also returns a structure, info, containing information about the resource grid and waveform resources.

nrWaveformGenerator opens the 5G Waveform Generator app.

Examples

collapse all

Create an SCS carrier configuration object with the default SCS of 15 kHz and 100 resource blocks.

carrier = nrSCSCarrierConfig('NSizeGrid',100);

Create a customized BWP configuration object for the SCS carrier.

bwp = nrWavegenBWPConfig('NStartBWP',carrier.NStartGrid+10);

Create an SS burst configuration object with block pattern Case A.

ssb = nrWavegenSSBurstConfig('BlockPattern','Case A');

Create a PDCCH configuration object, specifying an aggregation of size two and the fourth candidate for the PDCCH instance.

pdcch = nrWavegenPDCCHConfig('AggregationLevel',2,'AllocatedCandidate',4);

Create a CORESET configuration object, specifying four frequency resources and a duration of three OFDM symbols.

coreset = nrCORESETConfig;
coreset.FrequencyResources = [1 1 1 1];
coreset.Duration = 3;

Create a search space set configuration object, specifying two aggregation levels.

ss = nrSearchSpaceConfig;
ss.NumCandidates = [8 4 0 0 0];

Create a PDSCH configuration object, specifying the modulation scheme and the target code rate. Enable the PDSCH PT-RS.

pdsch = nrWavegenPDSCHConfig( ...
    'Modulation','16QAM','TargetCodeRate',658/1024,'EnablePTRS',true);

Create a PDSCH DM-RS and a PDSCH PT-RS configuration object with the specified property values.

dmrs = nrPDSCHDMRSConfig('DMRSTypeAPosition',3);
pdsch.DMRS = dmrs;
ptrs = nrPDSCHPTRSConfig('TimeDensity',2);
pdsch.PTRS = ptrs;

Create a CSI-RS configuration object with the specified property values.

csirs = nrWavegenCSIRSConfig('RowNumber',4,'RBOffset',10,'NumRB',10,'SymbolLocations',5);

Create a single-user 5G downlink waveform configuration object, specifying the previously defined configurations.

cfgDL = nrDLCarrierConfig( ...
    'FrequencyRange','FR1', ...
    'ChannelBandwidth',40, ...
    'NumSubframes',20, ...
    'SCSCarriers',{carrier}, ...
    'BandwidthParts',{bwp}, ...
    'SSBurst',ssb, ...
    'CORESET',{coreset}, ...
    'SearchSpaces',{ss}, ...
    'PDCCH',{pdcch}, ...
    'PDSCH',{pdsch}, ...
    'CSIRS',{csirs});

Generate a 5G downlink waveform using the specified configuration.

waveform = nrWaveformGenerator(cfgDL);

Create two SCS carrier configuration objects with mixed numerologies and custom numbers of resource blocks.

carriers = {
    nrSCSCarrierConfig('SubcarrierSpacing',15,'NStartGrid',10,'NSizeGrid',100), ...
    nrSCSCarrierConfig('SubcarrierSpacing',30,'NStartGrid',0,'NSizeGrid',70)};
    

Create two custom BWP configuration objects, one for each of the carriers.

bwp = {
    nrWavegenBWPConfig('BandwidthPartID',1,'SubcarrierSpacing',15,'NStartBWP',10,'NSizeBWP',80), ...
    nrWavegenBWPConfig('BandwidthPartID',2,'SubcarrierSpacing',30,'NStartBWP',0,'NSizeBWP',60)};

Create an SS burst configuration object with block pattern Case A, corresponding to an SCS of 15 kHz.

ssb = nrWavegenSSBurstConfig('BlockPattern','Case A');

Create two PDCCH configuration objects.

pdcch = {
    nrWavegenPDCCHConfig('SearchSpaceID',1,'BandwidthPartID',1,'RNTI',1,'DMRSScramblingID',1), ...
    nrWavegenPDCCHConfig('SearchSpaceID',2,'BandwidthPartID',2,'RNTI',2,'DMRSScramblingID',2, ...
        'AggregationLevel',4)};
    

Create two CORESET configuration objects and two search space set configuration objects for the two PDCCH.

coreset = {
    nrCORESETConfig('CORESETID',1,'FrequencyResources',[1 1 1 1 1 0 0 0 0 0 1],'Duration',3), ...
    nrCORESETConfig('CORESETID',2,'FrequencyResources',[0 0 0 0 0 0 0 0 1 1])};

ss = {
    nrSearchSpaceConfig('SearchSpaceID',1,'CORESETID',1,'StartSymbolWithinSlot',4), ...
    nrSearchSpaceConfig('SearchSpaceID',2,'CORESETID',2,'NumCandidates',[8 8 4 0 0])};

Create two PDSCH configuration objects with mixed modulation schemes.

pdsch = {
    nrWavegenPDSCHConfig('BandwidthPartID',1,'Modulation','16QAM','RNTI',1,'NID',1,'PRBSet',10:51), ...
    nrWavegenPDSCHConfig('BandwidthPartID',2,'Modulation','QPSK','RNTI',2,'NID',2, ...
            'PRBSet', 50:59)};

Create two CSI-RS configuration objects.

 csirs = {
     nrWavegenCSIRSConfig('BandwidthPartID',1,'RowNumber',2,'RBOffset',20), ... 
     nrWavegenCSIRSConfig('BandwidthPartID',2,'Density','one','RowNumber',4,'NumRB',10)};

Create a multiuser 5G downlink waveform configuration object, specifying the previously defined configurations.

cfgDL = nrDLCarrierConfig( ...
    'FrequencyRange','FR1', ...
    'ChannelBandwidth',40, ...
    'NumSubframes',20, ...
    'SCSCarriers',carriers, ...
    'BandwidthParts',bwp, ...
    'SSBurst',ssb, ...
    'CORESET',coreset, ...
    'SearchSpaces',ss, ...
    'PDCCH',pdcch, ...
    'PDSCH',pdsch, ...
    'CSIRS',csirs);

Generate a 5G downlink waveform using the specified configuration.

waveform = nrWaveformGenerator(cfgDL);

Create an SCS carrier configuration object with the default SCS of 15 kHz and 100 resource blocks.

carrier = nrSCSCarrierConfig('NSizeGrid',100);

Create a customized BWP configuration object for the SCS carrier.

bwp = nrWavegenBWPConfig('NStartBWP',carrier.NStartGrid+10);

Create a single-user 5G uplink waveform configuration object, specifying the previously defined configurations. In the uplink configuration object, by default, the PUSCH is enabled, while the PUCCH and the SRS are disabled.

cfgUL = nrULCarrierConfig( ...
    'FrequencyRange','FR1', ...
    'ChannelBandwidth',40, ...
    'NumSubframes',20, ...
    'SCSCarriers',{carrier}, ...
    'BandwidthParts',{bwp});

Generate a 5G uplink waveform using the specified configuration.

waveform = nrWaveformGenerator(cfgUL);

Create two SCS carrier configuration objects with mixed numerologies and custom numbers of resource blocks.

carriers = {
    nrSCSCarrierConfig('SubcarrierSpacing',15,'NStartGrid',10,'NSizeGrid',100), ...
    nrSCSCarrierConfig('SubcarrierSpacing',30,'NStartGrid',0,'NSizeGrid',70)};

Create two custom BWP configuration objects, one for each of the carriers.

bwp = {
    nrWavegenBWPConfig('BandwidthPartID',0,'SubcarrierSpacing',15,'NStartBWP',30,'NSizeBWP',80), ...
    nrWavegenBWPConfig('BandwidthPartID',1,'SubcarrierSpacing',30,'NStartBWP',0,'NSizeBWP',60)};

Create two PUSCH configuration objects, one for each of the carriers, with mixed modulation schemes.

pusch = {
    nrWavegenPUSCHConfig('BandwidthPartID',0,'Modulation','16QAM','SlotAllocation',0:2:9,'PRBSet',0:19,'RNTI',1,'NID',1), ...
    nrWavegenPUSCHConfig('BandwidthPartID',1,'Modulation','QPSK','RNTI',2,'NID',2,'PRBSet',50:59)};

Create a single PUCCH configuration object, only for the second carrier. By default, the PUCCH is enabled in this configuration.

pucch = {nrWavegenPUCCH0Config('BandwidthPartID',1,'SlotAllocation',0:9,'PRBSet',2,'DataSourceUCI', 'PN9')};

Create two SRS configuration objects, one for each of the carriers. By default, the SRS is enabled in both configurations.

srs = {
    nrWavegenSRSConfig('BandwidthPartID',0,'SlotAllocation',1:2:9,'NumSRSPorts',2), ... 
    nrWavegenSRSConfig('BandwidthPartID',1,'FrequencyStart',4)};

Create a multiuser 5G uplink waveform configuration object, specifying the previously defined configurations.

cfgUL = nrULCarrierConfig( ...
    'FrequencyRange','FR1', ...
    'ChannelBandwidth',40, ...
    'NumSubframes',20, ...
    'SCSCarriers',carriers, ...
    'BandwidthParts',bwp, ...
    'PUSCH',pusch, ...
    'PUCCH',pucch, ...
    'SRS',srs);

Generate a 5G uplink waveform using the specified configuration.

waveform = nrWaveformGenerator(cfgUL);

Input Arguments

collapse all

Configuration parameters for 5G NR waveform generation, specified as an nrDLCarrierConfig or nrULCarrierConfig object.

Output Arguments

collapse all

Time-domain 5G NR waveform, returned as a complex matrix. The number of matrix columns correspond to the number of transmit antennas.

Data Types: double
Complex Number Support: Yes

Metadata of 5G waveform, returned as a structure with these fields.

BWP information, returned as a structure with these fields.

FieldValueDescription
ResourceGridBWPComplex 2-D or 3-D arrayBWP resource grid
ResourceGridInCarrierComplex 2-D or 3-D arrayBWP resource grid in carrier
InfoStructure array

Each structure in the array contains these fields.

FieldValueDescription
NfftPositive integerNumber of fast Fourier transform (FFT) points
SampleRateReal numberWaveform sample rate
CyclicPrefixLengthsRow vector of positive integersCyclic prefix lengths of each OFDM symbol in a subframe, in samples
SymbolLengthsRow vector of positive integersOFDM symbol lengths, in samples
WindowingPositive integerNumber of time-domain samples over which the function applies raised cosine windowing and overlapping of OFDM symbols
SymbolPhasesVector of integers

Phase compensation of each OFDM symbol, in radians

SymbolsPerSlot12 or 14Number of OFDM symbols in a slot
SlotsPerSubframe1, 2, 4, or 8 Number of slots in a 1 ms subframe
SlotsPerFramePositive integerNumber of slots in a 10 ms frame
k0Nonnegative integerFrequency starting position per antenna port and OFDM symbol

Data Types: struct

Information about waveform resources, returned as a structure with these fields.

FieldValueDescription

PDCCH

(returned for only downlink waveforms)

1-by-NPDCCH structure array, where NPDCCH is the number of configured PDCCH in input cfg

Each structure in the array contains these fields.

FieldValueDescription
NameCharacter arrayName of PDCCH configuration
CDMLengthsTwo-element vector of integersCDM arrangement for reference signals
Resources

1-by-MPDCCH structure array, where MPDCCH is the number of allocated slots for the specified PDCCH

Each structure in the array contains these fields.

FieldValueDescription
NSlotNonnegative integerSlot number
DCIBitsBinary-valued column vectorDownlink control information (DCI) bits
CodewordBinary-valued column vectorEncoded DCI codeword
GNonnegative integerBit capacity of the PDCCH
GdNonnegative integerNumber of resource elements per layer or port
ChannelIndicesColumn vector of positive integersPDCCH indices relative to the associated BWP
ChannelSymbolsComplex column vectorPDCCH symbols
DMRSIndicesColumn vector of positive integersPDCCH DM-RS indices relative to the associated BWP
DMRSSymbolsComplex column vectorPDCCH DM-RS symbols

PDSCH

(returned for only downlink waveforms)

1-by-NPDSCH structure array, where NPDSCH is the number of configured PDSCH in cfg

Each structure in the array contains these fields.

FieldValueDescription
NameCharacter arrayName of PDSCH configuration
CDMLengthsTwo-element integer vectorCDM arrangement for reference signals
Resources

1-by-MPDSCH structure array, where MPDSCH is the number of allocated slots for the specified PDSCH

Each structure in the array contains these fields.

FieldsValues 
NSlotNonnegative integerSlot number
TransportBlockSizeNonnegative integerSize of PDSCH transport block
TransportBlockBinary-valued column vectorPDSCH transport block
RVNonnegative integerRedundancy version
Codeword

Binary-valued column vector

Cell array of two binary-valued column vectors

Codeword(s) from DL-SCH transport channel
GNonnegative integerBit capacity of the PDSCH. This value is equal to the length of the codeword from the DL-SCH transport channel.
GdNonnegative integer

Number of resource elements per layer or port

ChannelIndicesColumn vector of positive integersPDSCH indices relative to the associated BWP
ChannelSymbolsComplex column vectorPDSCH symbols
DMRSIndicesColumn vector of positive integersPDSCH DM-RS indices relative to the associated BWP
DMRSSymbolsComplex column vectorPDSCH DM-RS symbols
DMRSSymbolSetVector of nonnegative integers

OFDM symbol locations in a slot containing the DM-RS (0-based)

PTRSIndicesColumn vector of positive integersPDSCH PT-RS indices relative to the associated BWP
PTRSSymbolsComplex column vectorPDSCH PT-RS symbols
PTRSSymbolSetVector of nonnegative integers

OFDM symbol locations in a slot containing PT-RS (0-based)

PUSCH

(returned for only uplink waveforms)

1-by-NPUSCH structure array, where NPUSCH is the number of configured PUSCH in cfg

Each structure in the array contains these fields.

FieldValueDescription
NameCharacter arrayName of PUSCH configuration
CDMLengthsTwo-element integer vectorCDM arrangement for reference signals
Resources

1-by-MPUSCH structure array, where MPUSCH is the number of allocated slots for the specified PUSCH

Each structure in the array contains these fields.

FieldValue 
NSlotNonnegative integerSlot number
TransportBlockSizeNonnegative integerSize of PUSCH transport block
TransportBlockBinary-valued column vectorPUSCH transport block
RVNonnegative integerRedundancy version
Codeword

Binary-valued column vector

Codeword from UL-SCH transport channel
GNonnegative integerBit capacity of the PUSCH. This value is equal to the length of the codeword from the UL-SCH transport channel.
GdNonnegative integer

Number of resource elements per layer or port

ChannelIndicesColumn vector of positive integersPUSCH indices relative to the associated BWP
ChannelSymbolsComplex column vectorPUSCH symbols
DMRSIndicesColumn vector of positive integersPUSCH DM-RS indices relative to the associated BWP
DMRSSymbolsComplex column vectorPUSCH DM-RS symbols
DMRSSymbolSetVector of nonnegative integers

OFDM symbol locations in a slot containing the DM-RS (0-based)

PTRSIndicesColumn vector of positive integersPUSCH PT-RS indices relative to the associated BWP
PTRSSymbolsComplex column vectorPUSCH PT-RS symbols
PTRSSymbolSetVector of nonnegative integers

OFDM symbol locations in a slot containing PT-RS (0-based)

PUCCH

(returned for only uplink waveforms)

1-by-NPUCCH structure array, where NPUCCH is the number of configured PUCCH in cfg

Each structure in the array contains these fields.

FieldValueDescription
NameCharacter arrayName of PUCCH configuration
FormatInteger from 0 to 4 or []PUCCH format
CDMLengthTwo-element integer vectorCDM arrangement for reference signals
Resources

1-by-MPUCCH structure array, where MPUCCH is the number of allocated slots for the specified PUCCH

Each structure in the array contains these fields.

FieldValue 
NSlotNonnegative integerSlot number
SRBit (returned only for format 0)Binary-valued scalarScheduling request (SR) bit
UCIBitsBinary-valued column vectorUplink control information (UCI) bits
UCI2Bits (returned only for formats 3 and 4)Binary-valued column vectorUCI part 2 bits
Codeword

Binary-valued column vector

Two-element cell array of binary-valued column vectors (applies to only format 0)

Codeword containing the UCI bits
GNonnegative integerBit capacity of the PUCCH. This value is equal to the length of the codeword.
GdNonnegative integer

Symbol capacity of the PUCCH

ChannelIndicesColumn vector of positive integersPUCCH indices relative to the associated BWP
ChannelSymbolsComplex column vectorPUCCH symbols
DMRSIndices (returned only for formats 1, 2, 3, and 4)Column vector of positive integersPUCCH DM-RS indices relative to the associated BWP
DMRSSymbols (returned only for formats 1, 2, 3, and 4)Complex column vectorPUCCH DM-RS symbols

SRS

(returned for only uplink waveforms)

1-by-NSRS structure array, where NSRS is the number of configured SRS in cfg

Each structure in the array contains these fields.

FieldValueDescription
NameCharacter arrayName of SRS configuration
Resources

1-by-MSRS structure array, where MSRS is the number of allocated slots for the specified SRS

Each structure in the array contains these fields.

FieldValue 
NSlotNonnegative integerSlot number
SignalIndicesColumn vector of positive integersSRS indices relative to the associated BWP
SignalSymbolsComplex column vectorSRS symbols

Data Types: struct

Data Types: struct

Extended Capabilities

Version History

Introduced in R2020b

expand all