This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

comm.Descrambler System object

Package: comm

Descramble input signal


The Descrambler object descrambles a scalar or column vector input signal. The Descrambler object is the inverse of the Scrambler object. If you use the Scrambler object in a transmitter, then you use the Descrambler object in the related receiver.

To descramble a scalar or column vector input signal:

  1. Define and set up your descrambler object. See Construction.

  2. Call step to descramble an input signal according to the properties of comm.Descrambler. The behavior of step is specific to each object in the toolbox.

    Note:   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.Descrambler creates a descrambler System object, H. This object descrambles the input data using a linear feedback shift register that you specify with the Polynomial property.

H = comm.Descrambler(Name,Value) creates a descrambler 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.Descrambler(N,POLY,COND,Name,Value) creates a descrambler object, H. This object has the CalculationBase property set to N, the Polynomial property set to POLY, the InitialConditions property set to COND, and the other specified properties set to the specified values.



Range of input data

Specify calculation base as a positive, integer, scalar value. The step method input and output integers are in the range [0, CalculationBase–1]. The default is 4.


Linear feedback shift register connections

Specify the polynomial that determines the shift register feedback connections. The default is '1+ z^-1 + z^-2 + z^-4'. You can specify the generator polynomial as a character vector or as a numeric, binary vector that lists the coefficients of the polynomial in order of ascending powers of z–1, where p(z–1) = 1 + p1z-1 + p2z-2 + ... is the generator polynomial. The first and last elements must be 1. Alternatively, you can specify the generator polynomial as a numeric vector. This vector must contain the exponents of z–1 for the nonzero terms of the polynomial, in order of ascending powers of z–1. In this case, the first vector element must be 0. For example, '1+ z^-6 + z^-8', [1 0 0 0 0 0 1 0 1], and [0 -6 -8] specify the same polynomial p(z1)=1+z6+z8.


Source of initial conditions

Specify the source of the InitialConditions property as either Property or Input port. If set to Input port, the initial conditions are provided as an input argument to the step function. The default value is Property.


Initial values of linear feedback shift register

Specify the initial values of the linear feedback shift register as an integer row vector with values in [0 CalculationBase–1]. The default is [0 1 2 3]. The length of this property vector must equal the order of the Polynomial property vector. This property is available when InitialConditionsSource is set to Property.


Descrambler state reset port

Specify the creation of an input port that is used to reset the state of the descrambler. If ResetInputPort is true, the descrambler is reset when a nonzero input argument is provided to the step function. The default value is false. This property is available when InitialConditionsSource is set to Property.


resetReset states of descrambler object
stepDescramble input signal
Common to All System Objects

Create System object with same property values


Expected number of inputs to a System object


Expected number of outputs of a System object


Check locked states of a System object (logical)


Allow System object property value changes


expand all

Scramble and descramble 8-ary data using comm.Scrambler and comm.Descrambler System objects™ having a calculation base of 8.

Create scrambler and descrambler objects while specifying the generator polymomial and initial conditions using name-value pairs. Note that the scrambler and descrambler polynomials are specified with different but equivalent syntaxes.

N = 8;
scrambler = comm.Scrambler(N,'1 + z^-2 + z^-3 + z^-5 + z^-7', ...
    [0 3 2 2 5 1 7]);
descrambler = comm.Descrambler(N,[1 0 1 1 0 1 0 1], ...
    [0 3 2 2 5 1 7]);

Scramble and descramble random integers. Display the original data, scrambled data, and descrambled data sequences.

data = randi([0 N-1],5,1);
scrData = scrambler(data);
deScrData = descrambler(scrData);
[data scrData deScrData]
ans =

     6     7     6
     7     5     7
     1     7     1
     7     0     7
     5     3     5

Verify the descrambled data matches the original data.

ans =



Scramble and descramble quaternary data while changing the initial conditions between function calls.

Create scrambler and descrambler System objects™. Set the InitialConditionsSource property to Input port to be able to set the initial conditions as an argument to the object.

N = 4;
scrambler = comm.Scrambler(N,'1 + z^-3','InitialConditionsSource','Input port');
descrambler = comm.Descrambler(N,'1 + z^-3','InitialConditionsSource','Input port');

Allocate memory for errVec.

errVec = zeros(10,1);

Scramble and descramble random integers while changing the initial conditions, initCond, each time the loop executes. Use the symerr function to determine if the scrambling and descrambing operations result in symbol errors.

for k = 1:10
    initCond = randperm(3)';
    data = randi([0 N-1],5,1);
    scrData = scrambler(data,initCond);
    deScrData = descrambler(scrData,initCond);
    errVec(k) = symerr(data,deScrData);

Examine errVec to verify that the output from the descrambler matches the original data.

errVec =



This object implements the algorithm, inputs, and outputs described on the Descrambler block reference page. The object properties correspond to the block parameters.

Extended Capabilities

Introduced in R2012a

Was this topic helpful?