nrOFDMModulate
Syntax
Description
[
generates waveform
,info
] = nrOFDMModulate(carrier
,grid
)waveform
, a time-domain waveform, by performing orthogonal
frequency-division multiplexing (OFDM) modulation of carrier resource array
grid
for carrier configuration parameters
carrier
. The function also returns info
, a
structure containing OFDM information.
[
modulates the carrier resource array with subcarrier spacing waveform
,info
] = nrOFDMModulate(grid
,scs
,initialNSlot
)scs
and
initial slot number initialNSlot
.
[
specifies options by using one or more name-value pair arguments in addition to the input
arguments in any of the previous syntaxes.waveform
,info
] = nrOFDMModulate(___,Name,Value
)
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);
Generate OFDM Modulated Waveform for Extended Cyclic Prefix
Generate a waveform by performing OFDM modulation of a resource array that contains physical downlink shared channel (PDSCH) demodulation reference signal (DM-RS) symbols.
Set carrier configuration parameters, specifying a subcarrier spacing of 60 kHz.
scs = 60;
carrier = nrCarrierConfig('SubcarrierSpacing',scs);
Generate PDSCH 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.
grid = nrResourceGrid(carrier,p); grid(ind) = sym;
Generate an OFDM modulated waveform, specifying the subcarrier spacing, initial slot number, and cyclic prefix type. Display the OFDM information.
initialNSlot = carrier.NSlot; cpl = 'extended'; [waveform,info] = nrOFDMModulate(grid,scs,initialNSlot,'CyclicPrefix',cpl); disp(info)
Nfft: 1024 SampleRate: 61440000 CyclicPrefixLengths: [256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256] SymbolLengths: [1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 1280 ... ] (1x48 double) Windowing: 36 SymbolPhases: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] SymbolsPerSlot: 12 SlotsPerSubframe: 4 SlotsPerFrame: 40
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. Only
these object properties are relevant for this function.
grid
— Carrier resource array
complex-valued array
Carrier resource array, specified as a complex-valued array of size K-by-N-by-P.
K is the number of subcarriers.
N is the number of OFDM symbols.
P is the number of transmit antennas.
Data Types: single
| double
Complex Number Support: Yes
scs
— Subcarrier spacing in kHz
15
| 30
| 60
| 120
| 240
| 480
| 960
Subcarrier spacing in kHz, specified as 15
, 30
,
60
, 120
, 240
,
480
, or 960
.
Data Types: double
initialNSlot
— Initial slot number
nonnegative integer
Initial slot number, in 0-based form, specified as a nonnegative integer. The
function selects the appropriate cyclic prefix lengths for OFDM
modulation
by using the value of initialNSlot
mod S, where
S is the number of slots per subframe.
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: 'CyclicPrefix','extended'
specifies extended cyclic prefix
length.
CyclicPrefix
— Cyclic prefix length
'normal'
(default) | 'extended'
Cyclic prefix length, specified as the comma-separated pair consisting of
'CyclicPrefix'
and one of these values:
'normal'
— Use this value to specify normal cyclic prefix. This option corresponds to 14 OFDM symbols in a slot.'extended'
— Use this value to specify extended cyclic prefix. This option corresponds to 12 OFDM symbols in a slot. For the numerologies specified in TS 38.211 Section 4.2, the extended cyclic prefix length only applies to 60 kHz subcarrier spacing.
Note
If you specify the carrier
input, use the
CyclicPrefix
property of the carrier
input to specify the cyclic prefix length. You cannot use this name-value pair
argument together with the carrier
input.
Data Types: char
| string
Nfft
— Number of FFT points
integer greater than 127 (default depends on other input values) | []
Number of fast Fourier transform (FFT) points, specified as the comma-separated pair
consisting of 'Nfft'
and a nonnegative integer greater than 127 or
[]
. The value you specify must result in integer-valued cyclic
prefix lengths and a maximum occupancy of 100%. The occupancy is defined as the value of (12 ×
NRB)/Nfft
, where NRB is the number of
resource blocks.
If you do not specify this input, or if you specify 'Nfft',[]
, the
function sets an integer value greater than 127 as a default value for this input. The
actual default value depends on other input values.
If you do not specify the
SampleRate
input, or if you specify'SampleRate',[]
, the function setsNfft
satisfying these conditions.Nfft
is an integer power of 2.Nfft
results in a maximum occupancy of 85%.
If you specify the
SampleRate
input, the function setsNfft
satisfying these conditions.
For more information, see Configure OFDM Sample Rate and FFT Size.
Data Types: double
SampleRate
— Waveform sample rate
positive scalar (default depends on other input values) | []
Waveform sample rate, specified as the comma-separated pair consisting of
'SampleRate'
and either a positive scalar or
[]
.
If you do not specify this input, or if you specify
'SampleRate',[]
, then the function sets this input to the value of
Nfft × SCS.
For more information, see Configure OFDM Sample Rate and FFT Size.
Data Types: double
Windowing
— Number of time-domain samples for OFDM symbol windowing and overlapping
nonnegative integer (default depends on other input values) | []
Number of time-domain samples over which the function applies raised cosine windowing and overlapping of OFDM symbols, specified as the comma-separated pair consisting of 'Windowing'
and either a nonnegative integer or []
.
If you do not specify this input, or if you specify 'Windowing',[]
, the
function sets this input to the maximum value E that does not impact
error vector magnitude (EVM) tests, as specified in TS 38.101-1 Annexes F.5.3 and F.5.4,
TS 38.101-2 Annexes F.5.3 and F.5.4, and TS 38.104 Annexes B.5.2 and C.5.2.
E is equal to value of
floor
((NCP −
W) ×
info
.Nfft
⁄ NFFT, nominal), where
NCP, W, and
NFFT, nominal are the values in the table
columns labeled "Cyclic prefix length", "EVM window length", and "FFT size",
respectively.
Data Types: double
CarrierFrequency
— Carrier frequency in Hz
0
(default) | real number
Carrier frequency in Hz, specified as the comma-separated pair consisting of
'CarrierFrequency'
and a real number. This input corresponds to
f0, defined in TS 38.211 Section
5.4.
Data Types: double
Output Arguments
waveform
— OFDM modulated waveform
complex-valued matrix
OFDM modulated waveform, returned as a complex-valued matrix of size T-by-P.
T is the number of time-domain samples in the waveform.
P is the number of transmit antennas.
Data Types: single
| double
Complex Number Support: Yes
info
— OFDM information
structure
OFDM information, returned as a structure containing these fields.
Fields | Values | Description |
---|---|---|
Nfft | Positive integer | Number of FFT points |
SampleRate | Positive scalar | Waveform sample rate |
CyclicPrefixLengths | 1-by-N vector of positive integers, where N is the number of OFDM symbols in a subframe. | Cyclic prefix lengths of each OFDM symbol, in samples |
SymbolLengths | 1-by-N vector of positive integers | OFDM symbol lengths, in samples |
Windowing | Positive integer | Number of time-domain samples over which the function applies raised cosine windowing and overlapping of OFDM symbols |
SymbolPhases | 1-by-N vector of scalars in the interval [-π, π] | Phase compensation of each OFDM symbol, in radians The
function applies this compensation during modulation to account for phase
terms per OFDM symbol, as specified in TS 38.211 Section 5.4 [4]. The
|
SymbolsPerSlot | Positive integer | Number of OFDM symbols in a slot |
SlotsPerSubframe | Positive integer | Number of slots in a 1 ms subframe |
SlotsPerFrame | Positive integer | Number of slots in a 10 ms frame |
Note
The number of samples in the CyclicPrefixLengths
, SymbolLengths
, and Windowing
structure fields apply to the sample rate of the IFFT of size Nfft
that is used during OFDM symbol construction. However, the IFFT sample rate can differ from the waveform sample rate when the SampleRate
name-value argument specifies an arbitrary sample rate.
Data Types: struct
References
[1] 3GPP TS 38.101-1. “NR; User Equipment (UE) radio transmission and reception; Part 1: Range 1 Standalone.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.
[2] 3GPP TS 38.101-2. “NR; User Equipment (UE) radio transmission and reception; Part 2: Range 2 Standalone.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.
[3] 3GPP TS 38.104. “NR; Base Station (BS) radio transmission and reception.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.
[4] 3GPP TS 38.211. “NR; Physical channels and modulation.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
The
'SampleRate'
name-value argument must be compile-time constant for code generation. For example, when you call the function with'SampleRate',15.36e6
, include{coder.Constant('SampleRate'),coder.Constant(15.36e6)}
in the-args
value of thecodegen
function. For more information, see thecoder.Constant
(MATLAB Coder) class.If you specify the
'SampleRate'
name-value argument, the first dimension ofgrid
and thescs
input arguments must also be compile-time constants. For example, include also{coder.typeof(grid,[624 Inf Inf],[0 1 1])}
and{coder.Constant(scs)}
in the-args
value of thecodegen
function.The
'SampleRate'
name-value pair argument cannot be used together with thecarrier
input.
GPU Arrays
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™. (since R2024a)
The nrOFDMModulate
function
fully supports GPU arrays. To run the function on a GPU, specify the input data as a gpuArray
(Parallel Computing Toolbox). For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Version History
Introduced in R2020bR2024a: GPU array support
The nrOFDMModulate
function now supports GPU arrays. For more
information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
R2023a: Subcarrier spacing for FR2-2
The function now supports 480 kHz and 960 kHz subcarrier spacings, as defined in TS 38.211 Sections 4.2 and 4.3.
R2023a: C/C++ code generation updates
For C/C++ code generation, the limitation to specify
'CyclicPrefix'
, 'Windowing'
,
'CarrierFrequency'
, or 'Nfft'
name-value
arguments as compile-time constants has been removed. However, if you specify the
'SampleRate'
name-value argument, the 'Nfft'
name-value argument must still be compile-time constant for code generation.
See Also
Functions
Objects
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 (한국어)