Main Content

shift2mask

Convert shift to mask vector for linear shift register

Description

mask = shift2mask(prpoly,shift) returns the mask that is equivalent to the shift (or offset) specified by shift for a linear feedback shift register with connections specified by the primitive polynomial prpoly.

Note

The input prpoly must be primitive to produce a meaningful output. Use the isprimitive function to check if prpoly is primitive. For more information, see primpoly or [2].

example

Examples

collapse all

Convert a shift in a linear feedback shift register into an equivalent mask.

Convert a shift of 5 into the equivalent mask x3+x+1 for the linear feedback shift register with connections specified by the primitive polynomial x4+x3+1. The length of the mask is equal to the degree of the primitive polynomial, 4.

mk = shift2mask([1 1 0 0 1],5)
mk = 1×4

     1     0     1     1

Convert a shift of 7 to a mask of x4+x2 for the primitive polynomial x5+x2+1.

mk2 = shift2mask('x5+x2+1',7)
mk2 = 1×5

     1     0     1     0     0

Input Arguments

collapse all

Shift value of a linear feedback shift register, specified as an integer scalar.

Data Types: double

Primitive polynomial, specified as one of the following:

  • A character vector or string scalar of a polynomial. For more information, see Representation of Polynomials in Communications Toolbox.

  • A binary vector that lists the coefficients of the primitive polynomial in order of descending powers.

  • An integer scalar whose binary representation gives the coefficients of the primitive polynomial, where the least significant bit is the constant term.

Data Types: double | char | string

More About

collapse all

Algorithms

collapse all

References

[1] Lee, J. S., and L. E. Miller, CDMA Systems Engineering Handbook, Boston, Artech House, 1998.

[2] Simon, Marvin K., Jim K. Omura, et al., Spread Spectrum Communications Handbook, New York, McGraw-Hill, 1994.

Version History

Introduced before R2006a