comm.GoldSequence System object

Package: comm

Generate Gold sequence

Description

The GoldSequence object generates a Gold sequence. Gold sequences form a large class of sequences that have good periodic cross-correlation properties.

To generate a Gold sequence:

  1. Define and set up your Gold sequence object. See Construction.

  2. Call step to generate the Gold sequence according to the properties of comm.GoldSequence. The behavior of step is specific to each object in the toolbox.

Construction

H = comm.GoldSequence creates a Gold sequence generator System object™, H. This object generates a pseudo-random Gold sequence.

H = comm.GoldSequence(Name,Value) creates a Gold sequence generator 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).

Properties

FirstPolynomial

Generator polynomial for first preferred PN sequence

Specify the polynomial that determines the feedback connections for the shift register of the first preferred PN sequence generator. The default is [1 0 0 0 0 1 1]. You can specify the generator polynomial as a numeric, binary vector that lists the coefficients of the polynomial in descending order of powers. The first and last elements must equal 1, and the length of this vector requires a value of n+1, where n is the degree of the generator polynomial. Alternatively, you can specify the generator polynomial as a numeric vector containing the exponents of z for the nonzero terms of the polynomial in descending order of powers. The last entry must be 0. For example, [1 0 0 0 0 0 1 0 1] and [8 2 0] represent the same polynomial, g(z)=z8+z2+1. The degree of the first generator polynomial must equal the degree of the second generator polynomial specified in the SecondPolynomial property.

FirstInitialConditions

Initial conditions for first PN sequence generator

Specify the initial conditions for the shift register of the first preferred PN sequence generator. The default is [0 0 0 0 0 1]. The initial conditions require a numeric, binary scalar, or a numeric, binary vector with length equal to the degree of the first generator polynomial specified in the FirstPolynomial property. If you set this property to a vector, each element of the vector corresponds to the initial value of the corresponding cell in the shift register. If you set this property to a scalar, the initial conditions of all shift register cells are the specified scalar value.

SecondPolynomial

Generator polynomial for second preferred PN sequence

Specify the polynomial that determines the feedback connections for the shift register of the second preferred PN sequence generator. The default is [1 1 0 0 1 1 1]. You can specify the generator polynomial as a binary, numeric vector that lists the coefficients of the polynomial in descending order of powers. The first and last elements must equal 1, and the length of this vector requires a value of n+1, where n is the degree of the generator polynomial. Alternatively, you can specify the generator polynomial as a numeric vector containing the exponents of z for the nonzero terms of the polynomial in descending order of powers. The last entry must be 0. For example, [1 0 0 0 0 0 1 0 1] and [8 2 0] represent the same polynomial, g(z)=z8+z2+1. The degree of the second generator polynomial must equal the degree of the first generator polynomial specified in the FirstPolynomial property.

SecondInitialConditionsSource

Source of initial conditions for second PN sequence

Specify the source of the initial conditions that determines the start of the second PN sequence as one of Property | Input port. The default is Property. When you set this property to Property, you can specify the initial conditions as a scalar or binary vector using the SecondInitialConditions property. When you set this property to Input port, you specify the initial conditions as an input to the stepmethod. The object accepts a binary scalar or a binary vector input. The length of the input must equal the degree of the generator polynomial that the SecondPolynomial property specifies.

SecondInitialConditions

Initial conditions for second PN sequence generator

Specify the initial conditions for the shift register of the second preferred PN sequence generator as a numeric, binary scalar, or as a numeric, binary vector. The length must equal the degree of the second generator polynomial. You set the second generator polynomial in the SecondPolynomial property.

When you set this property to a vector, each element of the vector corresponds to the initial value of the corresponding cell in the shift register. The default is [0 0 0 0 0 1].

When you set this property to a scalar, the initial conditions of all shift register cells are the specified scalar value.

Index

Index of output sequence of interest

Specify the index of the output sequence of interest from the set of available sequences as a scalar integer. The default is 0. The scalar integer must be in the range [–2, 2n–2], where n is the degree of the generator polynomials you specify in the FirstPolynomial and SecondPolynomial properties.

The index values -2 and -1 correspond to the first and second preferred PN sequences as generated by the FirstPolynomial and SecondPolynomial, respectively.

The set G(u, v) of available Gold sequences is defined by G(u,v) = {u, v, (uxor Tv), (u xor T2v), ..., (u xor T((N–1)v))}.In this case, T represents the operator that shifts vectors cyclically to the left by one place, and u, v represent the two preferred PN sequences. Also, G(u,v) contains N+2 Gold sequences of period N. You select the desired sequence from this set using the Index property.

Shift

Sequence offset from initial time

Specify the offset of the Gold sequence from its starting point as a numeric, integer scalar value that can be positive or negative. The default is 0. The Gold sequence has a period of N = 2n1, where n is the degree of the generator polynomials specified in the FirstPolynomial and SecondPolynomial properties. The shift value is wrapped with respect to the sequence period.

VariableSizeOutput

Enable variable-size outputs

Set this property to true to enable an additional input to the step method. The default is false. When you set this property to true, the enabled input specifies the output size of the Gold sequence used for the step. The input value must be less than or equal to the value of the MaximumOutputSize property.

When you set this property to false, the SamplesPerFrame property specifies the number of output samples.

MaximumOutputSize

Maximum output size

Specify the maximum output size of the Gold sequence as a positive integer 2-element row vector. The second element of the vector must be 1. The default is [10 1].

This property applies when you set the VariableSizeOutput property to true.

SamplesPerFrame

Number of output samples per frame

Specify the number of Gold sequence samples that the step method outputs as a numeric, integer scalar value. The default is 1. If you set this property to a value of M, then the step method outputs M samples of a Gold sequence with a period of N = 2n1. The value of n represents the degree of the generator polynomials that you specify in the FirstPolynomial and SecondPolynomial properties.

ResetInputPort

Enable generator reset input

Set this property to true to enable an additional reset input to the step method. The default is false. This input resets the states of the two shift registers of the Gold sequence generator to the initial conditions specified in the FirstInitialConditions and SecondInitialConditions properties.

OutputDataType

Data type of output

Specify the output data type as one of double | logical | Smallest unsigned integer. The default is double.

You must have a Fixed-Point Designer™ user license to use this property in Smallest unsigned integer mode.

Methods

cloneCreate Gold sequence generator object with same property values
getNumInputsNumber of expected inputs to step method
getNumOutputsNumber of outputs from step method
isLockedLocked status for input attributes and nontunable properties
releaseAllow property value and input characteristics changes
resetReset states of Gold sequence generator object
stepGenerate a Gold sequence

Examples

Get 10 samples of a Gold sequence of period 251.

    hgld = comm.GoldSequence('FirstPolynomial',[5 2 0],...
             'SecondPolynomial', [5 4 3 2 0],...
             'FirstInitialConditions', [0 0 0 0 1],...
             'SecondInitialConditions', [0 0 0 0 1],...
             'Index', 4, 'SamplesPerFrame', 10);
    x = step(hgld)

Algorithms

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

Was this topic helpful?