Main Content


Demodulate using BPSK method


The 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 a binary phase shift signal:

  1. Define and set up your BPSK demodulator object. See Construction.

  2. Call step to demodulate a signal according to the properties of comm.BPSKDemodulator. The behavior of step is specific to each object in the toolbox.


Starting in R2016b, instead of using the step method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, y = step(obj,x) and y = obj(x) perform equivalent operations.


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

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

H = comm.BPSKDemodulator(PHASE,Name,Value) creates a BPSK demodulator object, H, with the PhaseOffset property set to PHASE, and the other specified properties set to the specified values.



Phase of zeroth point of constellation

Specify the phase offset of the zeroth point of the constellation, in radians, as a finite, real scalar. The default is 0.


Demodulation decision method

Specify the decision method the object uses as one of Hard decision | Log-likelihood ratio | Approximate log-likelihood ratio. The default is Hard decision.


Source of noise variance

Specify the source of the noise variance as one of Property | Input port. The default is Property. This property applies when you set the DecisionMethod property to Log-likelihood ratio or Approximate log-likelihood ratio.


Noise variance

Specify the variance of the noise as a nonzero, real scalar. The default is 1. 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 applies when you set the VarianceSource property to Property. This property is tunable.


Data type of output

Specify the output data type as one of Full precision | Smallest unsigned integer | double | single | int8 | uint8 | int16 | uint16 | int32 | uint32 | logical. The default is Full precision. This property applies only when you set the DecisionMethod property to Hard decision. Thus, when you set the OutputDataType property to Full precision, and the input data type is single or double precision, the output data has the same data type as the input. If the input data is of a fixed-point type, then the output data type behaves as if you had set the OutputDataType property to Smallest unsigned integer. If you set the DecisionMethod property to Log-likelihood ratio or Approximate log-likelihood ratio, the output data type is the same as that of the input. In this case, that data type can only be single or double precision.

When the input signal is an integer data type, you must have a Fixed-Point Designer™ user license to use this property in Smallest unsigned integer or Full precision mode.

 Fixed-Point Properties


constellationCalculate or plot ideal signal constellation
stepDemodulate using BPSK method
Common to All System Objects

Allow System object property value changes


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