Main Content


Demodulate using BPSK method


The comm.BPSKDemodulator object demodulates a signal that was modulated using the binary phase shift keying method. The input is a baseband representation of the modulated signal.

To demodulate using BPSK:

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




bpskdemod = comm.BPSKDemodulator creates a demodulator System object™ bpskdemod, that demodulates the input signal using the binary phase shift keying (BPSK) method.

bpskdemod = comm.BPSKDemodulator(Name,Value) creates a BPSK demodulator System object, bpskdemod, 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).

bpskdemod = comm.BPSKDemodulator(phase,Name,Value) creates a BPSK demodulator System object bpskdemod. The object's PhaseOffset property is set to phase, and the other specified properties are set to the specified values.


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 constellation in radians, specified as a finite real scalar.

Data Types: double

Demodulation decision method, specified as one of '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'.


This property applies when you set the DecisionMethod property to 'Log-likelihood ratio' or 'Approximate log-likelihood ratio'.

Data Types: char | string

Noise variance, specified as a nonzero, real scalar. If this value is very small (i.e., SNR is very high), log-likelihood ratio (LLR) computations can yield Inf or -Inf. This variance occurs because the LLR algorithm computes the exponential of very large or very small numbers using finite precision arithmetic. As a best practice in such cases, use approximate LLR because this option's algorithm does not compute exponentials. This property is tunable.


This property applies when you set the VarianceSource property to 'Property'.

Data Types: double

Output datatype, specified as either 'double', 'single' or Custom.

Data Types: char

Fixed-Point Properties

Data type of derotate factor, specified as one of 'Same word length as input' | 'Custom'.


This property applies when you set the DecisionMethod property to 'Hard decision'. The object uses the derotate factor in the computations only when certain conditions exist. The step method input must be of a fixed-point type, and the PhaseOffset property must have a value that 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.


This property applies when you set the OutputDataType property to 'Custom'.

Data Types: fi



data = bpskdemod(waveform) applies BPSK demodulation to the modulated waveform and returns the demodulated input signal.

Input Arguments

expand all

BPSK Modulated baseband signal, specified as a column vector or matrix of the same size as the input signal.

Data Types: double
Complex Number Support: Yes

Output Arguments

expand all

Output signal, returned as a column vector or matrix.

Data Types: double

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:


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


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

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


This object implements the algorithm, inputs, and outputs described on the BPSK Demodulator Baseband block reference page. The object properties correspond to the block parameters.

Extended Capabilities

Introduced in R2012a