nrResourceGrid
Syntax
Description
Examples
Generate OFDM Modulated Waveform
Generate a waveform by performing OFDM modulation of a resource array that contains sounding reference signals (SRSs). The resource array spans an entire frame.
Set carrier configuration parameters, specifying a subcarrier spacing of 30 kHz and 24 resource blocks (RBs) in the carrier resource array.
carrier = nrCarrierConfig('SubcarrierSpacing',30,'NSizeGrid',24);
Configure SRS parameters, setting the slot periodicity to 2
and the offset to zero.
srs = nrSRSConfig('SRSPeriod',[2 0]);
Get OFDM information for the specified carrier configuration.
info = nrOFDMInfo(carrier);
Produce the frame resource array by creating and concatenating individual slot resource arrays.
grid = []; for nslot = 0:(info.SlotsPerFrame - 1) carrier.NSlot = nslot; slotGrid = nrResourceGrid(carrier); ind = nrSRSIndices(carrier,srs); sym = nrSRS(carrier,srs); slotGrid(ind) = sym; grid = [grid slotGrid]; end
Perform OFDM modulation on the resource array for the specified carrier configuration.
[waveform,info] = nrOFDMModulate(carrier,grid);
Demodulate OFDM Waveform
Recover a transmitted carrier resource array by demodulating an OFDM waveform.
Set carrier configuration parameters, specifying 106 resource blocks (RBs) in the carrier resource array.
carrier = nrCarrierConfig('NSizeGrid',106);
Generate physical downlink shared channel (PDSCH) demodulation reference signal (DM-RS) symbols and indices.
p = 2;
pdsch = nrPDSCHConfig('NumLayers',p);
sym = nrPDSCHDMRS(carrier,pdsch);
ind = nrPDSCHDMRSIndices(carrier,pdsch);
Create a carrier resource array containing the PDSCH DM-RS symbols.
txGrid = nrResourceGrid(carrier,p); txGrid(ind) = sym;
Generate OFDM modulated waveform.
[txWaveform,~] = nrOFDMModulate(carrier,txGrid);
Pass the waveform through a simple 2-by-1 channel.
H = [0.6; 0.4]; waveform = txWaveform*H;
Recover the carrier resource array by demodulating the received OFDM waveform.
grid = nrOFDMDemodulate(carrier,waveform);
Generate OFDM Modulated Waveform for Specified Sample Rate
Generate a waveform by performing OFDM modulation of a resource array that contains PDSCH DM-RS symbols.
Set carrier configuration parameters, specifying 106 RBs in the carrier resource array.
carrier = nrCarrierConfig('NSizeGrid',106);
Configure PDSCH and generate the corresponding symbols and indices.
p = 4;
pdsch = nrPDSCHConfig('NumLayers',p);
sym = nrPDSCHDMRS(carrier,pdsch);
ind = nrPDSCHDMRSIndices(carrier,pdsch);
Create a carrier resource array and map the PDSCH symbols.
grid = nrResourceGrid(carrier,p,'OutputDataType','single'); grid(ind) = sym;
Generate OFDM modulated waveform, specifying the sample rate.
sr = 1e8;
[waveform,info] = nrOFDMModulate(carrier,grid,'SampleRate',sr);
Input Arguments
carrier
— Carrier configuration parameters
nrCarrierConfig
object
Carrier configuration parameters for a specific OFDM numerology, specified as an
nrCarrierConfig
object. This
function uses only these properties of the nrCarrierConfig
object.
p
— Number of antennas
positive integer
Number of antennas, specified as a positive integer.
Data Types: double
datatype
— Data type of output symbols
'double'
(default) | 'single'
Data type of the output symbols, specified as 'double'
or
'single'
.
Data Types: char
| string
Output Arguments
grid
— Empty carrier slot resource grid
complex-valued array
Empty carrier slot resource array, returned as a complex-valued array of size
K-by-L-by-p
.
K is the number of subcarriers.
L is the number of OFDM symbols.
Data Types: single
| double
Complex Number Support: Yes
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
The
datatype
input argument must be compile-time constant. For example,
when specifying 'single'
as the output data type, include
{coder.Constant('OutputDataType'),coder.Constant('single')}
in the
-args
value of the codegen
function. For more
information, see the coder.Constant
(MATLAB Coder) class.
Version History
Introduced in R2020b
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)