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

Descramble input signal


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

This schematic shows the descrambler operation. The adders and subtracter operate modulo N, where N is the value specified by the CalculationBase property.

At each time step, the input causes the contents of the registers to shift sequentially. Using the Polynomial property, you specify the on or off state for each switch in the descrambler. To make the comm.Descrambler object reverse the operation of the comm.Scrambler object, use the same property settings in both objects. If there is no signal delay between the scrambler and the descrambler, then the InitialConditions in the two objects must be the same.

To descramble an input signal:

  1. Create the comm.Descrambler 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? (MATLAB).



descrambler = comm.Descrambler
descrambler = comm.Descrambler(base,poly,cond)
descrambler = comm.Descrambler(___,Name,Value)


descrambler = comm.Descrambler creates a descrambler System object™. This object descrambles the input data by using a linear feedback shift register that you specify with the Polynomial property.


descrambler = comm.Descrambler(base,poly,cond) creates the descrambler object with the CalculationBase property set to base, the Polynomial property set to poly, and the InitialConditions property set to cond.

Example: comm.Descrambler(8,'1 + z^-2 + z^-3 + z^-5 + z^-7',[0 3 2 2 5 1 7]) sets the calculation base to 8, and the descrambler polynomial and initial conditions as specified.


descrambler = comm.Descrambler(___,Name,Value) sets properties using one or more name-value pairs and either of the previous syntaxes. Enclose each property name in single quotes.

Example: comm.Descrambler('CalculationBase',2)


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 (MATLAB).

Range of input data used in the descrambler for modulo operations, specified as a nonnegative integer. The input and output of this object are integers from 0 to CalculationBase1.

Data Types: double

Connections for linear feedback shift registers in the descrambler, specified as a character vector, integer vector, or binary vector. The Polynomial property defines if each switch in the descrambler is on or off. Specify the polynomial as:

  • A character vector, such as '1 + z^-6 + z^-8'. For more details on specifying polynomials in this way, see Character Representation of Polynomials.

  • An integer vector, such as [0 -6 -8], listing the descrambler coefficients in order of descending powers of z-1, where p(z-1) = 1 + p1z-1 + p2z-2 + ...

  • A binary vector, such as [1 0 0 0 0 0 1 0 1], listing the powers of z that appear in the polynomial that has a coefficient of 1. In this case, the order of the descramble polynomial is one less than the binary vector length.

Example: '1 + z^-6 + z^-8', [0 -6 -8], and [1 0 0 0 0 0 1 0 1] all represent this polynomial:

p(z-1) = 1 + z-6 + z-8

Data Types: double | char

  • 'Property' – Specify descrambler initial conditions by using the InitialConditions property.

  • 'Input port' – Specify descrambler initial conditions by using an additional input argument, initcond, when calling the object.

Data Types: char

Initial conditions of descrambler registers when the simulation starts, specified as a nonnegative integer vector. The length of InitialConditions must equal the order of the Polynomial property. The vector element values must be integers from 0 to CalculationBase1.


This property is available when InitialConditionsSource is set to 'Property'.

Descrambler state reset port, specified as false or true. If ResetInputPort is true, you can reset the descrambler object by using an additional input argument, reset, when calling the object.


This property is available when InitialConditionsSource is set to 'Property'.



descrambledOut = descrambler(signal)
descrambledOut = descrambler(signal,initcond)
descrambledOut = descrambler(signal,reset)



descrambledOut = descrambler(signal) descrambles the input signal. The output is the same data type and length as the input vector.


descrambledOut = descrambler(signal,initcond) provides an additional input with values specifying the initial conditions of the linear feedback shift register.

This syntax applies when you set the InitialConditionsSource property of the object to 'Input port'.

descrambledOut = descrambler(signal,reset) provides an additional input indicating whether to reset the state of the descrambler.

This syntax applies when you set the InitialConditionsSource property of the object to 'Property' and the ResetInputPort to true.

Input Arguments

expand all

Input signal, specified as a column vector.

Example: descrambledOut = descrambler([0 1 1 0 1 0])

Data Types: double | logical

Initial descrambler register conditions when the simulation starts, specified as a nonnegative integer column vector. The length of initcond must equal the order of the Polynomial property. The vector element values must be integers from 0 to CalculationBase1.

Example: descrambledOut = descrambler(signal,[0 1 1 0]) corresponds to possible initial register states for a descrambler with a polynomial order of 4 and a calculation base of 2 or higher.

Data Types: double

Reset initial state of the descrambler when the simulation starts, specified as a scalar. When the value of reset is nonzero, the object is reset before it is called.

Example: descrambledOut = descrambler(signal,0) descrambles the input signal without resetting the descarmbler states.

Data Types: double

Output Arguments

expand all

Descrambled output, returned as a column vector with the same data type and length as signal.

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:

stepRun System object algorithm
cloneCreate duplicate System object
getNumInputsNumber of inputs required to call the System object
getNumOutputsNumber of outputs from calling the System object
isLockedDetermine if System object is locked
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object


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, specifying the calculation base, polynomial, and initial conditions using input arguments. The scrambler and descrambler polynomials are specified with different but equivalent data formats.

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 that 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™ having a calculation base of 4. Set the InitialConditionsSource property to 'Input port' so you can 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');

Preallocate memory for the error vector which will be used to store errors output by the symerr function.

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 = 


Extended Capabilities

See Also

System Objects


Introduced in R2012a

Was this topic helpful?