nrWaveformGenerator
Description
[
generates 5G NR waveform wave
,info
] = nrWaveformGenerator(cfg
)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 annrDLCarrierConfig
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 annrULCarrierConfig
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
Configure and Generate Single-User 5G Downlink Waveform
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);
Configure and Generate Multiuser 5G Downlink Waveform
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);
Configure and Generate Single-User 5G Uplink Waveform
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);
Configure and Generate Multiuser 5G Uplink Waveform
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
cfg
— Configuration parameters for 5G NR waveform generation
nrDLCarrierConfig
object | nrULCarrierConfig
object
Configuration parameters for 5G NR waveform generation, specified as an nrDLCarrierConfig
or nrULCarrierConfig
object.
Output Arguments
wave
— Time-domain 5G NR waveform
complex matrix
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
info
— Metadata of 5G waveform
structure
Metadata of 5G waveform, returned as a structure with these fields.
ResourceGrids
— BWP information
structure
BWP information, returned as a structure with these fields.
Field | Value | Description | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ResourceGridBWP | Complex 2-D or 3-D array | BWP resource grid | |||||||||||||||||||||||||||||||||
ResourceGridInCarrier | Complex 2-D or 3-D array | BWP resource grid in carrier | |||||||||||||||||||||||||||||||||
Info | Structure array | Each structure in the array contains these fields.
|
Data Types: struct
WaveformResources
— Information about waveform resources
structure
Information about waveform resources, returned as a structure with these fields.
Field | Value | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
(returned for only downlink waveforms) | 1-by-NPDCCH
structure array, where
NPDCCH is the number of
configured PDCCH in input | Each structure in the array contains these fields.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(returned for only downlink waveforms) | 1-by-NPDSCH
structure array, where
NPDSCH is the number of
configured PDSCH in | Each structure in the array contains these fields.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(returned for only uplink waveforms) | 1-by-NPUSCH
structure array, where
NPUSCH is the number of
configured PUSCH in | Each structure in the array contains these fields.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(returned for only uplink waveforms) | 1-by-NPUCCH
structure array, where
NPUCCH is the number of
configured PUCCH in | Each structure in the array contains these fields.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(returned for only uplink waveforms) | 1-by-NSRS structure
array, where NSRS is the
number of configured SRS in | Each structure in the array contains these fields.
|
Data Types: struct
Data Types: struct
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
When the cfg
input is an
nrDLCarrierConfig
object, these limitations apply.
The
cfg.
SampleRate
property must be set to[]
or a value equal tocfg.BWP.
SubcarrierSpacing
times the FFT size.The
cfg.PDCCH.
DataSource
,cfg.PDSCH.
DataSource
, andcfg.SSBurst.
DataSource
properties cannot be set using a random seed. Set these properties by using the binary vector format or by using one of the predefined character vectors.The
info.WaveformResources.PDSCH.Resources.Codeword
output is always a cell array. When only one codeword exists, the second cell element is the empty array (for example,{[1 0 ...],[]}
).
When the cfg
input is an nrULCarrierConfig
object, these limitations apply.
The
cfg.
SampleRate
property must be set to[]
or a value equal tocfg.BWP.
SubcarrierSpacing
times the FFT size.The following properties cannot be set using a random seed. Set these properties by using the binary vector format or by using one of the predefined character vectors.
cfg.PUSCH.
DataSource
cfg.PUSCH.
DataSourceACK
cfg.PUSCH.
DataSourceCSI1
cfg.PUSCH.
DataSourceCSI2
cfg.PUSCH.
DataSourceCGUCI
cfg.PUCCH.
DataSourceSR
(applies to only PUCCH format 0)cfg.PUCCH.
DataSourceUCI
(applies to all PUCCH formats)cfg.PUCCH.
DataSourceUCI2
(applies to only PUCCH formats 3 and 4)
The
info.WaveformResources.PUSCH.Resources.Codeword
andinfo.WaveformResources.PUCCH.Resources.Codeword
(for formats 1, 2, 3, and 4) outputs are always returned as a cell array, where the second cell element is the empty array (for example,{[1 0 ...],[]}
).The
info.WaveformResources.PUCCH.Resources.SRBit
output is always returned as an empty array for formats 1, 2, 3, and 4.The
info.WaveformResources.PUCCH.Resources.UCI2Bits
output is always returned as an empty array for formats 0, 1, and 2.The
info.WaveformResources.PUCCH.Resources.DMRSIndices
andinfo.WaveformResources.PUCCH.Resources.DMRSSymbols
outputs are always returned as an empty array for format 0.
Version History
Introduced in R2020bR2023a: C/C++ code generation updates
For C/C++ code generation:
The limitation to set the
cfg.WindowingPercent
property to0
or[]
has been removed.The limitation to set the
cfg.CarrierFrequency
property to0
has been removed.The limitation imposed on the
cfg.SampleRate
object property has been updated. When you setcfg.SampleRate
to a value that equals SCS times the FFT size, the FFT size can now be any positive integer, not just a power of 2.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)