Main Content
(To be removed) Demodulate using BPSK method
expand all in page
comm.BPSKDemodulator will be removed in a future release. Use pskdemod instead. For information on updating your code, see Version History.
Description
The comm.BPSKDemodulator
System object™ demodulates a signal that was modulated using the binary phase shift keying method. The object maps the points exp(jθ) or -exp(jθ) to 0 and 1, respectively. The PhaseOffset property specifies the value of θ in radians.
To demodulate BPSK-modulated signal data:
Create the
comm.BPSKDemodulator
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
bpskdemodulator = comm.BPSKDemodulator
bpskdemodulator = comm.BPSKDemodulator(Name,Value)
bpskdemodulator = comm.BPSKDemodulator(phase,Name,Value)
Description
example
creates a demodulator System object that demodulates the input signal using the BPSK method.bpskdemodulator
= comm.BPSKDemodulator
creates a BPSK demodulator System object with each specified property set to the specified value. You can specify additional name-value pair arguments in any order as (bpskdemodulator
= comm.BPSKDemodulator(Name
,Value
)Name1
,Value1
,...,NameN
,ValueN
).
creates a BPSK demodulator System object with the PhaseOffset property is set to bpskdemodulator
= comm.BPSKDemodulator(phase
,Name
,Value
)phase
, and the other specified properties set to the specified values.
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 of constellation
0
(default) | scalar
Phase of zeroth point of the constellation in radians, specified as a scalar.
Data Types: double
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'
.
Data Types: char
| string
VarianceSource
— Source of noise variance
'Property'
(default) | 'Input port'
Source of noise variance, specified as one of 'Property'
or 'Input port'
.
Dependencies
To enable this property set the DecisionMethod property to 'Log-likelihood ratio'
or 'Approximate log-likelihood ratio'
.
Data Types: char
| string
Variance
— Noise variance
1 (default) | nonzero scalar
Noise variance, specified as a nonzero scalar. The demodulation object expects a complex input signal. In the case of BPSK, the modulator outputs a complex signal with a zero-valued imaginary part. If you instead input a real signal to the demodulator, you must represent the noise power of a complex signal in the real-valued input signal by setting the variance value to twice the variance of the real-valued input signal.
When the noise variance or signal power result in computations involving extreme positive or negative magnitudes, see BPSK Soft Demodulation for demodulation decision type considerations.
Tunable: Yes
Dependencies
To enable this property set the VarianceSource property to 'Property'
.
Data Types: double
OutputDataType
— Output datatype
'Full precision'
(default) | 'Smallest unsigned integer'
| 'double'
| 'single'
| 'int8'
| 'uint8'
| 'int16'
| 'uint16'
| 'int32'
| 'uint32'
| 'logical'
| ...
Output datatype, specified as one of these options.
When you set this property to
'Full precision'
, the output data type is the same as that of the input when the input data type is single or double precision. If the input data is of a fixed-point type, then the output data type works as if you had set this property to'Smallest unsigned integer'
.When you set the DecisionMethod property to
'Log-liklihood ratio'
or'Approximate log-liklihood ratio
, the output data type is the same as that of the input and the input data type must be single or double precision.Note
For integer data type inputs, the Fixed-Point Designer™ software is required when this property is set to
'Full precision'
or'Smallest unsigned integer'
.'Full precision'
'Smallest unsigned integer'
'double'
'single'
'int8'
'uint8'
'int16'
'uint16'
'int32'
'uint32'
'logical'
Dependencies
To enable this property set the DecisionMethod property to 'Hard decision'
.
Data Types: char
Fixed-Point Properties
DerotateFactorDataType
— Data type of derotate factor
'Same word length as input'
(default) | 'Custom'
Data type of derotate factor, specified as one of 'Same word length as input'
| 'Custom'
.
Dependencies
To enable this property set the DecisionMethod property to 'Hard decision'
. Additionally, the object uses the derotate factor in the computations only when the input must be of a fixed-point type, and the PhaseOffset property value is not a multiple of π/2.
Data Types: char
| string
CustomOutputDataType
— Fixed-point data type of output
numerictype([],16)
(default) | numerictype
object
Fixed-point data type of output, specified as a numerictype (Fixed-Point Designer) object with a signedness of Auto.
Dependencies
To enable this property set the OutputDataType property to 'Custom'
.
Data Types: fi
Usage
Syntax
data = bpskdemodulator(waveform)
data = bpskdemodulator(waveform,var)
Description
data = bpskdemodulator(waveform)
applies BPSK demodulation to the modulated waveform and returns the demodulated input signal.
data = bpskdemodulator(waveform,var)
uses soft decision demodulation and noise variance var
.
Input Arguments
expand all
waveform
— BPSK Modulated baseband signal
column vector | matrix
BPSK Modulated baseband signal, specified as a column vector or matrix of the same size as the input signal. For more information about the output datatype, see the OutputDataType property.
Data Types: double
| single
| fi
Complex Number Support: Yes
var
— Noise variance
nonzero scalar
Noise variance, specified as a nonzero scalar.
The demodulation object expects a complex input signal. In the case of BPSK, the modulator outputs a complex signal with a zero-valued imaginary part. If you instead input a real signal to the demodulator, you must represent the noise power of a complex signal in the real-valued input signal by setting the variance value to twice the variance of the real-valued input signal.
When the noise variance or signal power result in computations involving extreme positive or negative magnitudes, see BPSK Soft Demodulation for demodulation decision type considerations.
Dependencies
To enable this property set the VarianceSource property to 'Input port'
.
Data Types: double
| single
Output Arguments
expand all
data
— Output signal data
column vector | matrix
Output signal data, returned as a column vector or matrix. The OutputDataType specifies the data type for the output data.
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.BPSKDemodulator
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
Demodulate BPSK Signal and Calculate Errors
Generate a BPSK signal, pass it through an AWGN channel, demodulate the signal, and compute the error statistics.
Create BPSK modulator and demodulator System objects.
bpskModulator = comm.BPSKModulator;bpskDemodulator = comm.BPSKDemodulator;
Create an error rate calculator System object.
errorRate = comm.ErrorRate;
Generate 50-bit random data frames, apply BPSK modulation, pass the signal through an AWGN channel, demodulate the received data, and compile the error statistics.
for counter = 1:100 % Transmit a 50-symbol frame txData = randi([0 1],50,1); % Generate data modSig = bpskModulator(txData); % Modulate rxSig = awgn(modSig,5); % Pass through AWGN rxData = bpskDemodulator(rxSig); % Demodulate errorStats = errorRate(txData,rxData); % Collect error statsend
Display the cumulative error statistics.
fprintf('Error rate = %f\nNumber of errors = %d\n', ... errorStats(1), errorStats(2))
Error rate = 0.005600Number of errors = 28
More About
expand all
BPSK Hard-Decision Demodulation
When applying hard demodulation, the input signal type and phase offset are considered.
This figure shows the hard decision BPSK demodulator for a floating-point or fixed-point signal and trivial phase offset (multiple of π/2)
This figure shows the hard decision BPSK demodulator for a floating-point signal and nontrivial phase offset
This figure shows the hard decision BPSK demodulator for a fixed-point signal and nontrivial phase offset
BPSK Soft 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.BPSKDemodulator will be removed in a future release. Use the pskdemod function with the modulation order set to 2
to BPSK demodulate the input signal.
See Also
Functions
- pskmod | pskdemod
Blocks
- BPSK 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