Main Content

comm.BPSKDemodulator

(To be removed) Demodulate using BPSK method

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:

  1. Create the comm.BPSKDemodulator object and set its properties.

  2. 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

Description

bpskdemodulator = comm.BPSKDemodulator creates a demodulator System object that demodulates the input signal using the BPSK method.

example

bpskdemodulator = comm.BPSKDemodulator(Name,Value) 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 (Name1,Value1,...,NameN,ValueN).

bpskdemodulator = comm.BPSKDemodulator(phase,Name,Value) creates a BPSK demodulator System object with the PhaseOffset property is set to 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.

Phase of zeroth point of the constellation in radians, specified as a scalar.

Data Types: double

Demodulation decision method, specified as 'Hard decision', 'Log-likelihood ratio', or 'Approximate log-likelihood ratio'.

Data Types: char | string

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

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

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

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

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

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

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

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

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

constellationCalculate or plot ideal signal constellation
stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object

Examples

collapse all

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 stats
end

Display the cumulative error statistics.

fprintf('Error rate = %f\nNumber of errors = %d\n', ...
    errorStats(1), errorStats(2))
Error rate = 0.005600
Number of errors = 28

More About

expand all

Extended Capabilities

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

Blocks