# Differential coding

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Differential_coding
> Markdown URL: https://mediated.wiki/source/Differential_coding.md
> Source: https://en.wikipedia.org/wiki/Differential_coding
> Source revision: 1232770752
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

Technique in digital communications

In [digital communications](/source/Data_communication), **differential coding** is a technique used to provide *unambiguous* signal reception when using some types of [modulation](/source/Modulation). It makes transmissible data dependent on both the current and previous signal (or symbol) states.

The common types of modulation that may be used with differential coding include [phase-shift keying](/source/Phase-shift_keying) and [quadrature amplitude modulation](/source/Quadrature_amplitude_modulation).

## Purposes of differential coding

When data is transmitted over [balanced lines](/source/Balanced_line), it is easy to accidentally invert polarity in the cable between the transmitter and the receiver.

Similarly for [BPSK](/source/Phase-shift_keying). To demodulate BPSK, one needs to make a local oscillator *synchronous* with the remote one. This is accomplished by a [carrier recovery](/source/Carrier_recovery) circuit. However, the integer part of the recovered carrier is ambiguous. There are *n* valid but not equivalent phase shifts between the two oscillators. For BPSK, *n* = 2; the symbols appear inverted or not.

Differential encoding prevents inversion of the signal and symbols, respectively, from affecting the data.

Assuming that x i {\displaystyle x_{i}} is a bit intended for transmission and y i − 1 {\displaystyle y_{i-1}} was the symbol just transmitted, then the symbol to be transmitted for x i {\displaystyle x_{i}} is

y i = y i − 1 ⊕ x i , {\displaystyle y_{i}=y_{i-1}\oplus x_{i},} 1

where ⊕ {\displaystyle \oplus {}} indicates [binary](/source/Binary_number#Addition) or [modulo-2](/source/Modular_arithmetic) addition. On the decoding side, x i {\displaystyle x_{i}} is recovered as

x i = y i ⊕ y i − 1 . {\displaystyle x_{i}=y_{i}\oplus y_{i-1}.} 2

That is, x i {\displaystyle x_{i}} depends only on a difference between the symbols y i {\displaystyle y_{i}} and y i − 1 {\displaystyle y_{i-1}} and not on their values (inverted or not).

There are several different [line codes](/source/Line_code) designed to be **polarity insensitive**[1] - whether the data stream is inverted or not, the decoded data will always be correct.

The [line codes](/source/Line_code) with this property include [differential Manchester encoding](/source/Differential_Manchester_encoding), [bipolar encoding](/source/Bipolar_encoding), [NRZI](/source/Non-return-to-zero#NRZI), [biphase mark code](/source/Differential_Manchester_encoding), [coded mark inversion](/source/Coded_mark_inversion), and [MLT-3 encoding](/source/MLT-3_encoding).

## Conventional differential coding

A block diagram representation of a differential encoder. Note that the output is dependent on both the current and previous [register](/source/Hardware_register) state.

Another type of differential decoder.

A method illustrated above can deal with a data stream inversion (it is called *180° ambiguity*). Sometimes it is enough (e.g. if BPSK is used or if other ambiguities are detected by other circuits, such as a [Viterbi decoder](/source/Viterbi_decoder) or a [frame synchronizer](/source/Frame_synchronization)) and sometimes it isn't.

Generally speaking, a *differential coding* applies to *symbols* (these are not necessary the same symbols as used in the modulator). To resolve *180° ambiguity* only, bits are used as these symbols. When dealing with *90° ambiguity*, pairs of bits are used, and triplets of bits are used to resolve *45° ambiguity* (e.g. in [8PSK](/source/Phase-shift_keying#Higher-order_PSK)).

A *differential encoder* provides the (**[1](#math_1)**) operation, a *differential decoder* - the (**[2](#math_2)**) operation.

Both differential encoder and differential decoder are discrete [linear time-invariant systems](/source/Linear_time-invariant_system). The former is recursive and [IIR](/source/Infinite_impulse_response), the latter is non-recursive and thus [FIR](/source/Finite_impulse_response). They can be analyzed as [digital filters](/source/Digital_filter).

A *differential encoder* is similar to an analog [integrator](/source/Integrator). It has an [impulse response](/source/Impulse_response)

- h ( k ) = { 1 , if k ≥ 0 0 , if k < 0 {\displaystyle h(k)={\begin{cases}1,&{\mbox{if }}k\geq 0\\0,&{\mbox{if }}k<0\end{cases}}}

and a [transfer function](/source/Transfer_function)

- H ( z ) = 1 1 − z − 1 . {\displaystyle H(z)={\frac {1}{1-z^{-1}}}.}

A *differential decoder* is thus similar to an analog [differentiator](/source/Differentiator), its impulse response being

- h ( k ) = { 1 , if k = 0 − 1 , if k = 1 0 , otherwise {\displaystyle h(k)={\begin{cases}1,&{\mbox{if }}k=0\\-1,&{\mbox{if }}k=1\\0,&{\mbox{otherwise}}\end{cases}}}

and its transfer function

- H ( z ) = 1 − z − 1 . {\displaystyle H(z)=1-z^{-1}.}

Note that in binary (modulo-2) arithmetic, addition and subtraction (and positive and negative numbers) are equivalent.

## Generalized differential coding

Using the relation y i − 1 ⊕ x i = y i {\displaystyle y_{i-1}\oplus x_{i}=y_{i}} is not the only way of carrying out differential encoding. More generally, it can be any function u = F ( y , x ) {\displaystyle u=F(y,x)} provided that an equation u 0 = F ( y 0 , x ) {\displaystyle u_{0}=F(y_{0},x)} has one and only one solution for any y 0 {\displaystyle y_{0}} and u 0 {\displaystyle u_{0}} .

## Applications

Differential coding is widely used in [satellite](/source/Communications_satellite) and [radio relay](/source/Microwave_transmission) communications together with [PSK](/source/Phase-shift_keying) and [QAM](/source/Quadrature_amplitude_modulation) modulations.

## Drawbacks

Differential coding has one significant drawback: it leads to error multiplication. That is, if one symbol such as y i {\displaystyle y_{i}} was received incorrectly, two incorrect symbols x i {\displaystyle x_{i}} and x i + 1 {\displaystyle x_{i+1}} would be at the differential decoder's output, see: x i = y i ⊕ y i − 1 {\displaystyle x_{i}=y_{i}\oplus y_{i-1}} and x i + 1 = y i + 1 ⊕ y i {\displaystyle x_{i+1}=y_{i+1}\oplus y_{i}} . This approximately doubles the [BER](/source/Bit_error_rate) at signal-to-noise ratios for which errors rarely occur in consecutive symbols.

## Other techniques to resolve a phase ambiguity

Differential coding is not the only way to deal with a phase ambiguity. The other popular technique is to use *[syncwords](/source/Syncword)* for this purpose. That is, if a *frame synchronizer* detects repeated inverted sync-words, it inverts the whole stream. This method is used in [DVB-S](/source/DVB-S).

## See also

- [Phase-shift keying](/source/Phase-shift_keying)

- [Satellite modem](/source/Satellite_modem)

## External links and references

- [Intelsat](/source/Intelsat) Earth Station Standard IESS-308

- [DVB](/source/Digital_Video_Broadcasting) framing structure, channel coding and modulation for 11/12 GHz satellite services (EN 300 421)

1. **[^](#cite_ref-1)** ["Spread spectrum direct sequence"](http://www.dankr.net/skola/spread_spectrum/Final%20report.pdf) by Daniel Kraus

---
Adapted from the Wikipedia article [Differential coding](https://en.wikipedia.org/wiki/Differential_coding) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Differential_coding?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
