nrResourceGrid
Generate empty carrier slot resource grid
Syntax
Description
specifies options by using one or more name-value arguments in addition to the input
arguments in any of the previous syntaxes.grid = nrResourceGrid(___,Name=Value)
Examples
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);
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 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 configuration parameters for a specific OFDM numerology, specified as an
nrCarrierConfig object. This
function uses only these properties of the nrCarrierConfig object.
Number of antennas, specified as a positive integer.
Data Types: double
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN, where Name is
the argument name and Value is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name in quotes.
Example: OutputDataType='single'
specifies single data type for the output symbols.
Data type of the output symbols, specified as 'double' or
'single'.
Data Types: char | string
Since R2026a
Enable GPU processing, specified as one of these values:
'off'— The function executes on the CPU.'on'— The function executes on the GPU and returns the output grid as agpuArray(Parallel Computing Toolbox) object on the GPU.'auto'— If a GPU is available, the function automatically executes on the GPU and returns the output grid as agpuArrayobject on the GPU. If no GPUs are available, the function executes on the CPU.
To use a GPU to accelerate computations in MATLAB®, you must have Parallel Computing Toolbox™ and a supported GPU device. For more information on supported devices, see GPU Computing Requirements (Parallel Computing Toolbox) .
Data Types: char | string
Output Arguments
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
Usage notes and limitations:
Names and values in name-value pair arguments must be
compile-time constants. 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.
Refer to the usage notes and limitations in the C/C++ Code Generation section. The same usage notes and limitations apply to GPU code generation.
The nrResourceGrid function
supports GPU array input with these usage notes and limitations:
To enable GPU processing and return the generated resource grid on the GPU, call the function with the
UseGPUname-value argument set to'on'or'auto'.
For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Version History
Introduced in R2020bThe nrResourceGrid function adds support for GPU arrays. For more
information, see GPU Arrays.
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.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)