Main Content

comm.DifferentialDecoder

Decode binary signal using differential decoding

Description

The comm.DifferentialDecoder System object™ decodes the binary input signal. The output is the logical difference between the consecutive input element within a channel. For more information, see Algorithms.

To decode a binary signal using differential decoding:

  1. Create the comm.DifferentialDecoder 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

example

diffdec = comm.DifferentialDecoder creates a differential decoder System object. This object decodes a binary input signal that was previously encoded using a differential encoder.

diffdec = comm.DifferentialDecoder(Name=Value) sets properties using one or more name-value arguments. For example, comm.DifferentialDecoder(InitialCondition=5) sets the initial condition of the differential decoder to 5.

diffdec = comm.DifferentialDecoder(initcond) creates a differential decoder object with InitialCondition set to initcond. For example, when initcond is set to 1, this syntax creates the differential decoder object and sets the initial value used to generate initial output to 1.

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.

Initial value used by the decoder to generate initial output, specified as a scalar value. The object treats nonbinary values as binary, interpreting nonzero values as 1.

Data Types: double | logical

Usage

Description

Y = diffdec(X) decodes the differentially encoded input data, X, by using the differential decoding scheme and returns the decoded data, Y. For more information, see Algorithms.

Input Arguments

expand all

Differentially encoded message, specified as a scalar, vector, or matrix. The object treats nonbinary inputs as binary signals.

When the input is a matrix or a row vector, the object treats each column as a separate channel.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical | fiobject

Output Arguments

expand all

Decoded message, returned as a binary-valued scalar, vector, or matrix. This output signal has the same dimensions and data type as that of input X.

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

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

Create a differential encoder and decoder pair.

diffEnc = comm.DifferentialEncoder;
diffDec = comm.DifferentialDecoder;

Generate random binary data. Differentially encode and decode the data.

data = randi([0 1],100,1);
encData = diffEnc(data);
decData = diffDec(encData);

Determine the number of errors between the original data and the decoded data.

numErrors = biterr(data,decData)
numErrors = 0

Algorithms

The comm.DifferentialDecoder output is the logical difference between the consecutive input element within a channel. More specifically, the input and output are related by:

  • m(i1) = d(i1) XOR lastInupt (==InitialCondition property value for first input element)

  • m(ik) = d(ik) XOR d(ik-1), for k = 2:inputLen

  • lastInput = d(ik)

where:

  • d is the differentially encoded input.

  • m is the output message.

  • ik is the kth element.

  • inputLen is the length of d.

  • lastInput is the last element of d.

  • XOR is the logical exclusive-or operator.

Extended Capabilities

Version History

Introduced in R2012a

See Also

Objects

Blocks