(To be removed) Demodulate using QPSK method
expand all in page
comm.QPSKDemodulator will be removed in a future release. Use pskdemod instead. For information on updating your code, see Version History.
Description
The comm.QPSKDemodulator
object demodulates a signal that was modulated using the quadrature phase shift keying (QPSK) method. The input is a baseband representation of the modulated signal.
To demodulate a signal that was modulated using the QPSK method:
Create the
comm.QPSKDemodulator
object and set its properties.Call the object with arguments, as if it were a function.
To learn more about how System objects work, see What Are System Objects?
Creation
Syntax
qpskdemod = comm.QPSKDemodulator
qpskdemod = comm.QPSKDemodulator(Name=Value)
qpskdemod = comm.QPSKDemodulator(phase=Name,Value)
Description
qpskdemod = comm.QPSKDemodulator
creates a System object™ to demodulate input QPSK signals.
example
qpskdemod = comm.QPSKDemodulator(
sets properties using one or more name-value arguments. For example, Name
=Value
)DecisionMethod="Hard decision"
specifies demodulation using the hard-decision method.
qpskdemod = comm.QPSKDemodulator(
sets the PhaseOffset property to phase
=Name
,Value
)phase
, and optional name-value arguments. Specify phase
in radians.
Properties
expand all
Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.
If a property is tunable, you can change its value at any time.
For more information on changing property values, see System Design in MATLAB Using System Objects.
PhaseOffset
— Phase of zeroth point in constellation
pi/4
(default) | scalar
Phase of the zeroth point in the constellation in radians, specified as a scalar.
Example: PhaseOffset=0
aligns the QPSK signal constellation points on the axes {(1,0), (0,j), (-1,0), (0,-j)}.
Data Types: double
BitOutput
— Option to output data as bits
0
or false
(default) | 1
or true
Option to output data as bits, specified as a logical 0
(false
) or 1
(true
).
Set this property to
false
to output symbols as integer values in the range [0
,3
] with length equal to the input data vector length.Set this property to
true
to output a column vector of bit values with length equal to twice the input data vector length.
Data Types: logical
SymbolMapping
— Symbol encoding
'Gray'
(default) | 'Binary'
Symbol encoding mapping of constellation bits, specified as 'Gray'
or 'Binary'
.
Setting | Constellation Mapping for Integers | Constellation Mapping for Bits | Comment |
---|---|---|---|
| | | Map symbols using Gray-coded ordering. |
| | | Map symbols using natural binary-coded ordering. The signal constellation maps to the complex value |
DecisionMethod
— Demodulation decision method
'Hard decision'
(default) | 'Log-likelihood ratio'
| 'Approximate log-likelihood ratio'
Demodulation decision method, specified as 'Hard decision'
, 'Log-likelihood ratio'
, or 'Approximate log-likelihood ratio'
. When you set the BitOutput property to false
, the object always performs hard-decision demodulation.
Dependencies
To enable this property, set the BitOutput property to true
.
VarianceSource
— Source of noise variance
'Property'
(default) | 'Input port'
Source of noise variance, specified as 'Property'
or 'Input port'
.
Dependencies
To enable this property, set the BitOutput property to true
and the DecisionMethod property to 'Log-likelihood ratio'
or 'Approximate log-likelihood ratio'
.
Variance
— Noise variance
1
(default) | positive scalar
Noise variance, specified as a positive scalar.
Tunable: Yes
Tips
The exact LLR algorithm computes exponentials using finite precision arithmetic. For computations involving very large positive or negative magnitudes, the exact LLR algorithm yields:
Inf
or-Inf
if the noise variance is a very large valueNaN
if the noise variance and signal power are both very small values
The approximate LLR algorithm does not compute exponentials. You can avoid Inf
, -Inf
, and NaN
results by using the approximate LLR algorithm.
Dependencies
To enable this property, set the BitOutput property to true
, the DecisionMethod property to 'Log-likelihood ratio'
or 'Approximate log-likelihood ratio'
, and the VarianceSource property to 'Property'
.
Data Types: double
OutputDataType
— Data type of output
'Full precision'
(default) | 'Smallest unsigned integer'
| 'double'
| ...
Data type of the output, specified as 'Full precision'
, 'Smallest unsigned integer'
, 'double'
, 'single'
, 'int8'
, 'uint8'
, 'int16'
, 'uint16'
, 'int32'
, or 'uint32'
,'logical'
.
When the input data type is single or double precision and you set the BitOutput property to
true
, the DecisionMethod property to'Hard decision'
, and theOutputDataType
property to'Full precision'
, the output has the same data type as that of the input.When the input data is of a fixed-point type, the output data type behaves as if you had set the
OutputDataType
property to'Smallest unsigned integer'
.When you set
BitOutput
totrue
and theDecisionMethod
property to'Hard Decision'
, then'logical'
data type is a valid option.When you set the
BitOutput
property totrue
and theDecisionMethod
property to'Log-likelihood ratio'
or'Approximate log-likelihood ratio'
, the output data type is the same as that of the input and the input data type must be single or double precision.
Dependencies
To enable this property, set the BitOutput
property to false
or set the BitOutput
property to true
and the DecisionMethod
property to 'Hard decision'
.
Fixed-Point Properties
DerotateFactorDataType
— Data type of derotate factor
'Same word length as input'
(default) | 'Custom'
Data type of the derotate factor, specified as 'Same word length as input'
or 'Custom'
. The object uses the derotate factor in the computations only when the input signal is a fixed-point type and the PhaseOffset property has a value that is not an even multiple of π/4.
Dependencies
To enable this property, set the BitOutput property to false
or set the BitOutput
property to true
and the DecisionMethod property to 'Hard decision'
.
CustomDerotateFactorDataType
— Fixed-point data type of derotate factor
numerictype([],16)
(default) | unscaled numerictype
object
Fixed-point data type of the derotate factor, specified as an unscaled numerictype (Fixed-Point Designer) object with a Signedness
of Auto
.
Dependencies
To enable this property, set the DerotateFactorDataType property to 'Custom'
.
Data Types: numerictype object
Usage
Syntax
y = qpskdemod(x)
y = qpskdemod(x,var)
Description
example
y = qpskdemod(x)
applies QPSK demodulation to the input signal and returns the demodulated signal.
y = qpskdemod(x,var)
uses soft decision demodulation and noise variance var
. This syntax applies when you set the BitOutput property to true
, the DecisionMethod property to 'Approximate log-likelihood ratio'
or 'Log-likelihood ratio'
, and the VarianceSource property to 'Input port'
.
Input Arguments
expand all
x
— QPSK-modulated signal
scalar | column vector
QPSK-modulated signal, specified as a scalar or column vector.
Dependencies
The object accepts inputs with a signed integer data type or signed fixed point (sfi (Fixed-Point Designer)) objects when you set the BitOutput property to false
or you set the DecisionMethod property to 'Hard decision'
and the BitOutput
property to true
.
Data Types: double
| single
| int
| fi
var
— Noise variance
scalar
Noise variance, specified as a scalar.
Dependencies
To enable this argument, set the VarianceSource property to 'Input port'
, the BitOutput property to true
, and the DecisionMethod property to 'Approximate log-likelihood ratio'
or 'Log-likelihood ratio'
.
Data Types: single
| double
Output Arguments
expand all
y
— Output signal
scalar | column vector
Output signal, returned as a scalar or column vector. To specify whether the object outputs values as integers or bits, use the BitOutput property. To specify the output data type, use the OutputDataType property.
Object Functions
To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named obj
, use this syntax:
release(obj)
expand all
Specific to comm.QPSKDemodulator
constellation | Calculate or plot ideal signal constellation |
Common to All System Objects
step | Run System object algorithm |
release | Release resources and allow changes to System object property values and input characteristics |
reset | Reset internal states of System object |
Examples
collapse all
BER Estimate of QPSK Signal
Estimate the bit error rate of a QPSK modulated signal filtered through an AWGN channel.
Create a QPSK modulator and demodulator pair that operate on bits.
qpskModulator = comm.QPSKModulator('BitInput',true);qpskDemodulator = comm.QPSKDemodulator('BitOutput',true);
Create an AWGN channel object and an error rate counter.
channel = comm.AWGNChannel('EbNo',4,'BitsPerSymbol',2);errorRate = comm.ErrorRate;
Generate random binary data and apply QPSK modulation.
data = randi([0 1],1000,1);txSig = qpskModulator(data);
Pass the signal through the AWGN channel and demodulate it.
rxSig = channel(txSig);rxData = qpskDemodulator(rxSig);
Calculate the error statistics. Display the BER.
errorStats = errorRate(data,rxData);errorStats(1)
ans = 0.0100
More About
expand all
Hard-Decision QPSK Demodulation
The signal preprocessing required for QPSK demodulation depends on the configuration.
This figure shows the hard-decision QPSK demodulation signal diagram for the trivial phase offset (odd multiple of π/4) configuration.
This figure shows the hard-decision QPSK demodulation floating point signal diagram for the nontrivial phase offset configuration.
This figure shows the hard-decision QPSK demodulation fixed-point signal diagram for the nontrivial phase offset configuration.
Soft-Decision QPSK Demodulation
For soft demodulation, two soft-decision log-likelihood ratio (LLR) algorithms are available: exact LLR and approximate LLR. The exact LLR algorithm is more accurate but has slower execution speed than the approximate LLR algorithm. For further description of these algorithms, see the Hard- vs. Soft-Decision Demodulation topic.
Note
The exact LLR algorithm computes exponentials using finite precision arithmetic. For computations involving very large positive or negative magnitudes, the exact LLR algorithm yields:
Inf
or-Inf
if the noise variance is a very large valueNaN
if the noise variance and signal power are both very small values
The approximate LLR algorithm does not compute exponentials. You can avoid Inf
, -Inf
, and NaN
results by using the approximate LLR algorithm.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
See System Objects in MATLAB Code Generation (MATLAB Coder).
HDL Code Generation
Generate VHDL, Verilog and SystemVerilog code for FPGA and ASIC designs using HDL Coder™.
The software supports double
and single
data types for simulation, but not for HDL code generation.
To generate HDL code from predefined System objects, see HDL Code Generation from Viterbi Decoder System Object (HDL Coder).
Version History
Introduced in R2012a
collapse all
R2023a: To be removed
comm.QPSKDemodulator will be removed in a future release. Use the pskdemod function with the modulation order set to 4
to QPSK demodulate the input signal.
See Also
Functions
- pskmod | pskdemod
Objects
- comm.OQPSKModulator | comm.OQPSKDemodulator
Blocks
- QPSK Demodulator Baseband | OQPSK Demodulator Baseband
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:
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
- Deutsch
- English
- Français
- United Kingdom (English)
Contact your local office