nrSymbolDemodulate
Demodulate and convert symbols to bits
Syntax
Description
Examples
QPSK Demodulation with Soft Decision Mode
Generate a random sequence of binary values of length 40.
data = randi([0 1],40,1);
Generate modulated symbols using QPSK modulation.
modsymb = nrSymbolModulate(data,'QPSK');
Perform QPSK demodulation in soft decision mode for a noise variance of 0.1.
nVar = 0.1; recsymb = awgn(modsymb,1/nVar,1,'linear'); out = nrSymbolDemodulate(recsymb,'QPSK',nVar);
16-QAM Demodulation with Hard Decision Mode
Generate a random sequence of binary values of length 100.
data = randi([0 1],100,1,'int8');
Generate modulated symbols using 16-QAM modulation.
modsymb = nrSymbolModulate(data,'16QAM');
Add a noise to the modulated symbols corresponding to an SNR of 15 dB.
recsymb = awgn(modsymb,15);
Perform 16-QAM demodulation in hard decision mode.
demodbits = nrSymbolDemodulate(recsymb,'16QAM','DecisionType','Hard');
Check for bit errors.
numErr = biterr(data,demodbits)
numErr = 0
Input Arguments
in
— Codeword to demodulate
complex column vector
Codeword to demodulate, specified as a complex column vector.
Data Types: double
| single
Complex Number Support: Yes
mod
— Modulation scheme
'pi/2-BPSK'
| 'BPSK'
| 'QPSK'
| '16QAM'
| '64QAM'
| '256QAM'
| '1024QAM'
Modulation scheme, specified as 'pi/2-BPSK'
,
'BPSK'
, 'QPSK'
, '16QAM'
,
'64QAM'
, '256QAM'
, or
'1024QAM'
. This modulation scheme determines the modulation type
to be performed on the input codeword and the number of bits used per modulation symbol.
Modulation Scheme | Number of Bits Per Symbol |
---|---|
| 1 |
'QPSK' | 2 |
'16QAM' | 4 |
'64QAM' | 6 |
'256QAM' | 8 |
'1024QAM' | 10 |
Data Types: char
| string
nVar
— Noise variance
1e-10
(default) | nonnegative numeric scalar
Noise variance, specified as a nonnegative numeric scalar. The soft bits are scaled with the variance of additive white Gaussian noise (AWGN). The default value corresponds to an SNR of 100 dB, assuming unit signal power. This argument applies only for soft decision mode.
Note
The default value assumes the modulator and demodulator are connected
back-to-back where the noise variance is zero. To avoid +/-Inf
values in the output, the function uses 1e-10
as default value
for noise variance. To get appropriate results when the signal is transmitted
through a noisy channel, adjust the noise variance accordingly.
Data Types: double
decision
— Decision mode
'soft'
(default) | 'hard'
Decision mode, specified as 'soft'
or 'hard'
.
The decision mode controls the demodulation type performed on the received symbols.
'soft'
— Soft decision mode results in a numeric output containing the bitwise approximation to the log-likelihood ratios of the demodulated bits. The outputout
inherits its data type from the inputin
.'hard'
— Hard decision mode results in a binary output containing groups of bits corresponding to the closest constellation points to the inputin
. The outputout
is type-cast toint8
.
Data Types: char
| string
Output Arguments
out
— Demodulated output bits
numeric column vector | binary column vector
Demodulated output bits, returned as a numeric column vector or binary column vector. Demodulation is performed assuming the input constellation power normalization defined in TS 38.211 section 5.1 [1].
Modulation Scheme | Constellation Power Normalization Factor |
---|---|
| 1/sqrt(2) |
'16QAM' | 1/sqrt(10) |
'64QAM' | 1/sqrt(42) |
'256QAM' | 1/sqrt(170) |
'1024QAM' | 1/sqrt(682) |
Each demodulated symbol is mapped to a group of bits corresponding to the number of
bits per symbol in the modulation scheme mod
. The first bit represents the most significant bit, and the last bit
represents the least significant bit. The length of out
is the
length of the input in
multiplied by the number of bits per symbol.
The decision
mode controls the content and the data type of the
demodulated output bits.
Data Types: double
| single
| int8
References
[1] 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
'DecisionType'
name-value argument must be compile-time constant for
code generation. For example, when you call the function with
'DecisionType','soft'
include
{coder.Constant('DecisionType'),coder.Constant('soft')}
in the
-args
value of the codegen
function. For more
information, see coder.Constant
(MATLAB Coder).
GPU Arrays
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™. (since R2024a)
The nrSymbolDemodulate
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 R2018bR2024a: GPU array support
The nrSymbolDemodulate
function now supports GPU arrays. For more
information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
R2023a: Release 17 updates for 1024QAM
The function now supports 1024QAM modulation.
See Also
Functions
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
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)