sdr.diff_encode(x: ArrayLike, y_prev: int = 0) NDArray[int_]

Differentially encodes the input data \(x[k]\).

Parameters:
x: ArrayLike

The input uncoded data \(x[k]\).

y_prev: int = 0

The previous value of the output encoded data \(y[k-1]\).

Returns:

The differentially encoded data \(y[k]\).

Notes

Differential Encoder Block Diagram
x[k] -->@--------------+--> y[k]
        ^              |
        |   +------+   |
y[k-1]  +---| z^-1 |<--+
            +------+

x[k] = Input data
y[k] = Encoded data
z^-1 = Unit delay
@ = Adder

Examples

In [1]: sdr.diff_encode([0, 1, 0, 0, 1, 1])
Out[1]: array([0, 1, 1, 1, 0, 1])

In [2]: sdr.diff_decode([0, 1, 1, 1, 0, 1])
Out[2]: array([0, 1, 0, 0, 1, 1])