nrOFDMDemodulate
Demodulate OFDM waveform
Syntax
Description
demodulatesgrid
= nrOFDMDemodulate(waveform
,nrb
,scs
,initialNSlot
)waveform
fornrb
, the specified number of resource blocks, subcarrier spacingscs
, and initial slot numberinitialNSlot
.
通过使用一个或多个名称指定选项pair arguments in addition to the input arguments in any of the previous syntaxes.grid
= nrOFDMDemodulate(___,Name,Value
)
Examples
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);
Demodulate OFDM Waveform with Extended Cyclic Prefix
Recover a resource array that contains PDSCH DM-RS symbols by demodulating an OFDM waveform.
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.
txGrid = nrResourceGrid(carrier,p); txGrid(ind) = sym;
Generate an OFDM modulated waveform, specifying the subcarrier spacing, initial slot number, and cyclic prefix length.
initialNSlot = carrier.NSlot; cpl ='extended'; [txWaveform,info] = nrOFDMModulate(txGrid,scs,initialNSlot,'CyclicPrefix',cpl);
Pass the waveform through a simple 2-by-1 channel.
H = [0.9; 0.95]; waveform = txWaveform*H;
Recover the carrier resource array by demodulating the received OFDM waveform.
nrb = carrier.NSizeGrid; grid = nrOFDMDemodulate(waveform,nrb,scs,initialNSlot,'CyclicPrefix',cpl);
Demodulate OFDM Waveform with Specified Sample Rate
Recover a transmitted resource array that contains sounding reference signals (SRSs) and spans an entire frame by demodulating an OFDM waveform.
Set carrier configuration parameters, specifying a subcarrier spacing of 30 kHz and 24 resource blocks in the carrier resource array.
carrier = nrCarrierConfig('SubcarrierSpacing',30,'NSizeGrid',24);
Configure SRS parameters, setting the slot periodicity and offset.
srs = nrSRSConfig('SRSPeriod',[4 0]);
Get OFDM information for the specified carrier configuration.
info = nrOFDMInfo(carrier);
Produce the frame resource array by creating and concatenating slot resource arrays.
frameGrid = [];fornslot = 0:(info.SlotsPerFrame - 1) carrier.NSlot = nslot; slotGrid = nrResourceGrid(carrier); ind = nrSRSIndices(carrier,srs); sym = nrSRS(carrier,srs); slotGrid(ind) = sym; frameGrid = [frameGrid slotGrid];end
Generate the OFDM modulated waveform.
[txWaveform,~] = nrOFDMModulate(carrier,frameGrid);
Pass the waveform through a simple channel.
H = 0.86; waveform = txWaveform*H;
Recover the carrier resource array by demodulating the received OFDM waveform, specifying the sample rate.
sr = info.SampleRate; grid = nrOFDMDemodulate(carrier,waveform,'SampleRate',sr);
Input Arguments
carrier
—Carrier configuration parameters
nrCarrierConfig
object
Carrier configuration parameters for a specific OFDM numerology, specified as annrCarrierConfig
object. Only these object properties are relevant for this function.
NSizeGrid
— Number of RBs in carrier resource grid
52
(default) | integer from 1 to 275
Number of RBs in the carrier resource grid, specified as an integer from 1 to 275. The default value of52
corresponds to the maximum number of RBs of a 10 MHz carrier with 15 kHz SCS.
Data Types:double
SubcarrierSpacing
— Subcarrier spacing in kHz
15
(default) |30
|60
|120
|240
Subcarrier spacing in kHz, for all channels and reference signals of the carrier, specified as15
,30
,60
,120
, or240
.
Data Types:double
NSlot
— Slot number
0
(default) | nonnegative integer
Slot number, specified as a nonnegative integer. You can setNSlot
to a value larger than the number of slots per frame. For example, you can set this value using transmission loop counters in a MATLAB®simulation. In this case, you may have to ensure that the property value is modulo the number of slots per frame in a calling code.
Data Types:double
CyclicPrefix
— Cyclic prefix length
“正常”
(default) |'extended'
Cyclic prefix length, specified as one of these options.
“正常”
— 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, extended cyclic prefix length applies for only 60 kHz subcarrier spacing.
Data Types:char
|string
waveform
—OFDM modulated waveform
complex-valued matrix
OFDM modulated waveform, specified as a complex-valued matrix of sizeT-by-R.
Tis the number of time-domain samples in the waveform.
Ris the number of receive antennas.
Data Types:double
Complex Number Support:Yes
nrb
—Number of resource blocks
integer from 1 to 275
Number of resource blocks, specified as an integer from 1 to 275.
Data Types:double
scs
—Subcarrier spacing in kHz
15
|30
|60
|120
|240
Subcarrier spacing in kHz, specified as15
,30
,60
,120
, or240
.
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 demodulation by using the value ofinitialNSlot
modS, whereSis the number of slots per subframe.
Data Types:double
Name-Value Arguments
Specify optional pairs of arguments asName1=Value1,...,NameN=ValueN
, whereName
is the argument name andValue
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 encloseName
in quotes.
Example:'CyclicPrefixFraction',0.75
specifies the start location for demodulation relative to the cyclic prefix length.
CyclicPrefix
—Cyclic prefix length
“正常”
(default) |'extended'
Cyclic prefix length, specified as the comma-separated pair consisting of'CyclicPrefix'
and one of these values:
“正常”
— 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 thecarrier
input, use theCyclicPrefix
property of thecarrier
input to specify the cyclic prefix length. You cannot use this name-value pair argument together with thecarrier
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
, whereNRBis 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, seeConfigure 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 ofNfft×SCS.
For more information, seeConfigure OFDM Sample Rate and FFT Size.
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 tof0, defined in TS 38.211 Section 5.4.
Data Types:double
CyclicPrefixFraction
—FFT window position within cyclic prefix
0.5
(default) |scalar in the interval [0, 1]
Fast Fourier transform (FFT) window position within the cyclic prefix, specified as the comma-separated pair consisting of'CyclicPrefixFraction'
and a scalar in the interval [0, 1].
The value that you specify indicates the start location for OFDM demodulation relative to the beginning of the cyclic prefix.
Data Types:double
Output Arguments
grid
— Carrier resource array
complex-valued array
Carrier resource array, returned as a complex-valued array of sizeK-by-L-by-R.
Kis the number of subcarriers.
Lis the number of OFDM symbols.
Ris the number of receive antennas.
Data Types:double
Complex Number Support:Yes
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:
Names and values in name-value pair arguments must be compile-time constants. For example, when specifying extended cyclic prefix, include
{coder.Constant('CyclicPrefix'),coder.Constant('extended')}
in the-args
value of thecodegen
function. For more information, see thecoder.Constant
(MATLAB Coder)class.The input arguments
nrb
,scs
, andinitialNSlot
must be compile-time constants. For example, include{coder.Constant(nrb)}
,{coder.Constant (scs)}
, and{coder.Constant(initialNSlot)}
in the-args
value of thecodegen
function.The
'SampleRate'
name-value pair argument cannot be used together with thecarrier
input.
Version History
See Also
Functions
Objects
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
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)