Accelerating the pace of engineering and science

# comm.BPSKDemodulator System object

Package: comm

Demodulate using BPSK method

## Description

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.

## Construction

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.

## Properties

 PhaseOffset 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. DecisionMethod 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. VarianceSource 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. Variance 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. OutputDataType 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.

## Methods

 clone Create BPSK demodulator object with same property values constellation Calculate or plot ideal signal constellation getNumInputs Number of expected inputs to step method getNumOutputs Number of outputs from step method isLocked Locked status for input attributes and nontunable properties release Allow property value and input characteristics changes step Demodulate using BPSK method

## Examples

expand all

### Demodulate a 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.

```hMod = comm.BPSKModulator;
hDemod = comm.BPSKDemodulator;
```

Create an AWGN channel object. Set the NoiseMethod property to Signal to noise ratio (SNR) and the SNR property to 5.

```hAWGN = comm.AWGNChannel('NoiseMethod', ...
'Signal to noise ratio (SNR)','SNR',5);
```

Create an error rate calculator System object.

```hError = comm.ErrorRate;
```

Generate 50-bit random data frames, apply BPSK modulation, pass the signal through the AWGN channel, demodulate the received data, and compile the error statistics.

```for counter = 1:100
% Transmit a 50-symbol frame
data = randi([0 1],50,1);                    % Generate data
modSignal = step(hMod,data);                 % Modulate
noisySignal = step(hAWGN,modSignal);         % Pass through AWGN
errorStats = step(hError,data,receivedData); % 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
```

## Algorithms

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.