Generate Gold sequence from set of sequences
Communications Toolbox / Comm Sources / Sequence Generators
The Gold Sequence Generator block generates a binary sequence with small periodic cross-correlation properties from a bounded set of sequences. For more information on Gold sequences, see Gold Sequences.
This block can output sequences that vary in length during simulation. For more information about variable-size signals, see Variable-Size Signal Basics (Simulink).
oSiz
— Current output sizeCurrent output size, specified as a scalar or a two-element row vector. The second element of the vector must be 1
.
Example: [10 1]
indicates the current output column vector will be of size 10-by-1.
To enable this port select the Output variable-size signals parameter and set Maximum output size source to Dialog parameter
.
Data Types: double
Ref
— Reference input signalReference input signal, specified as a scalar, column vector.
To enable this port select the Output variable-size signals parameter and set Maximum output size source to Inherit from reference input
.
Data Types: double
Rst
— Reset signalReset signal, specified in one of these forms.
When the output size is variable specify as a scalar.
Otherwise, specify as a scalar or a 2-D column vector with a length equal to Samples per frame.
The output signal resets for nonzero Rst input values. For more information, see Reset Behavior
To enable this port, select the Reset on nonzero input parameter.
Data Types: double
Out
— Output signalOutput signal, returned as a binary column vector. At least one element of the Initial states (1) or Initial states (2) vector must be nonzero in order for the block to generate a nonzero sequence.
Data Types: double
Preferred polynomial (1)
— First sequence polynomial'z^6 + z + 1'
(default) | polynomial character vector | binary row vector | integer row vectorFirst sequence polynomial, specified in one of these forms.
A polynomial character vector such as 'z^3 + z^2 + 1'
.
A binary row vector that represents the coefficients of the generator polynomial in order of descending power. The length of this vector is (N+1), where N is the degree of the generator polynomial. For example, [1 1 0 1]
represents the polynomial x3+ z2+ 1.
An integer row vector containing the exponents of z for the nonzero terms in the polynomial in descending order. For example, [3 2 0]
represents the polynomial z3 + z2 + 1.
For more information, see Character Representation of Polynomials and Preferred Pairs of Sequences.
Initial states (1)
— Initial states for first sequence polynomial[0 0 0 0 0 1]
(default) | binary vectorInitial states of the shift register for first sequence polynomial of the preferred pair, specified as a binary vector with length equal to the degree of Preferred polynomial (1).
Preferred polynomial (2)
— Second sequence polynomial'z^6 + z^5 + z^2 + z + 1'
(default) | polynomial character vector | binary row vector | integer row vectorSecond sequence polynomial, specified in one of these forms.
A polynomial character vector such as 'z^3 + z^2 + 1'
.
A binary row vector that represents the coefficients of the generator polynomial in order of descending power. The length of this vector is (N+1), where N is the degree of the generator polynomial. For example, [1 1 0 1]
represents the polynomial x3+ z2+ 1.
An integer row vector containing the exponents of z for the nonzero terms in the polynomial in descending order. For example, [3 2 0]
represents the polynomial z3 + z2 + 1.
For more information, see Character Representation of Polynomials.
Initial states (2)
— Initial states for second sequence polynomial[0 0 0 0 0 1]
(default) | binary vectorInitial states of the shift register for second sequence polynomial of the preferred pair, specified as a binary vector with length equal to the degree of Preferred polynomial (2).
Sequence index
— Sequence index0
(default) | integer scalar in the range [–2, 2n–2]Sequence index of the output sequence from the set of sequences, specified as an integer scalar in the range [–2, 2n–2]. n is the degree of the preferred polynomials.
Shift
— Offset of Gold sequence0
(default) | integer scalarOffset of Gold sequence from the initial time, specified as an integer scalar.
Output variable-size signals
— Output variable-size signalsSelect this parameter to permit variable length output sequences during simulation. When set to off
, fixed-length sequences are output. When set to on
, variable-length sequences can be output. For information about variable-size signals, see Variable-Size Signal Basics (Simulink).
Maximum output size source
— Maximum output size sourceDialog parameter
(default) | Inherit from reference port
Maximum output size source, which indicates how the maximum sequence output size is specified.
Dialog parameter
configures the block to use the Maximum output size parameter setting as the maximum permitted output sequence length. When you make this selection, the oSiz input port specifies the current size of the output signal and the block output inherits sample time from the input signal. The input value of oSiz must be less than or equal to the Maximum output size parameter.
Inherit from reference port
adds the Ref
input port and configures the block to inherit the sample time, maximum size, and the current output size from the variable-sized signal at the Ref
input port to set the maximum permitted output sequence length.
To enable this parameter, select Output variable-size signals.
Maximum output size
— Maximum output size[10 1]
(default) | two-element row vectorMaximum output size, specified as a two-element row vector that denotes the maximum
output size for the block. The second element of the vector must be
1
.
Example: [10 1]
gives a 10-by-1 maximum sized output
signal.
To enable this parameter select Output variable-size signals
and set Maximum output size source to Dialog
parameter
.
Data Types: double
Sample time
— Output sample time1
(default)Output sample time, specified as -1
or a
positive scalar that represents the time between each sample of the output signal. If
Sample time is set to -1
, the sample time is
inherited from downstream. For information on the relationship between Sample
time and Samples per frame, see
Sample Timing.
To enable this parameter do not select Output variable-size signals.
Samples per frame
— Samples per frame1
(default) | positive integerSamples per frame, specified as a positive integer indicating the number of samples per frame in one channel of the output data. For information on the relationship between Sample time and Samples per frame, see Sample Timing.
To enable this parameter do not select Output variable-size signals.
Reset on nonzero input
— Reset output signaloff
(default) | on
Select this parameter to enable the Rst port. When a nonzero value is input at the Rst port, the internal shift registers are reset to the original values of the Initial states (1) and Initial states (2) parameters.
Output data type
— Output data typedouble
(default) | boolean
| Smallest unsigned integer
Output data type, specified as boolean
, double
, or Smallest unsigned integer
.
When set to Smallest unsigned integer
, the output data type is selected based on the settings used in the Hardware Implementation Pane (Simulink) of the Configuration Parameters dialog box of the model. If ASIC/FPGA is selected in the Hardware Implementation pane, the output data type is the ideal minimum one-bit size (ufix(1)). For all other selections, it is an unsigned integer with the smallest available word length large enough to fit one bit, usually corresponding to the size of a char (uint8).
Data Types |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
The time between output updates is equal to the product of Samples per frame and Sample time. For example, if Sample time and Samples per frame equal one, the block outputs a sample every second. If Samples per frame is increased to 10, then a 10-by-1 vector is output every 10 seconds. This ensures that the equivalent output rate is not dependent on the Samples per frame parameter.
The characteristic cross-correlation properties of Gold sequences make them useful when multiple devices are broadcasting in the same frequency range. The Gold sequences are defined using a specified pair of sequences u and v, of period N = 2n – 1, called a preferred pair, as defined in Preferred Pairs of Sequences. The set G(u, v) of Gold sequences is defined by
where T represents the operator that shifts vectors cyclically to the left by one place, and represents addition modulo 2. Note that G(u,v) contains N + 2 sequences of period N. The Gold Sequence Generator block outputs one Gold sequence according to the configured parameters and inputs.
Gold sequences have the property that the cross-correlation between any two, or between shifted versions of them, takes on one of three values: –t(n), –1, or t(n) – 2, where
The Gold Sequence Generator block uses two PN Sequence Generator blocks to generate the preferred pair of sequences, and then XORs these sequences to produce the output sequence, as shown in the following diagram.
You can specify the preferred pair by the Preferred polynomial (1) and Preferred polynomial (2) parameters in the dialog for the Gold Sequence Generator block. These polynomials, both of which must have degree n, describe the shift registers that the PN Sequence Generator blocks use to generate their output. For more details on how these sequences are generated, see the reference page for the PN Sequence Generator block. You can specify the preferred polynomials using these formats:
A polynomial character vector that includes the number 1
, for example, 'z^4 + z + 1'
.
A vector that lists the coefficients of the polynomial in descending order of powers. The first and last entries must be 1. Note that the length of this vector is one more than the degree of the generator polynomial.
A 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, the polynomial z5 + z2 + 1 can be represented by the character vector 'z^5 + z^2 + 1'
, the vector [5 2 0]
, and the vector [1 0 0 1 0 1]
.
The following table provides a short list of preferred pairs.
n | N | Preferred Polynomial (1) | Preferred Polynomial (2) |
---|---|---|---|
5 | 31 |
[5 2 0]
|
[5 4 3 2 0]
|
6 | 63 |
[6 1 0]
|
[6 5 2 1 0]
|
7 | 127 |
[7 3 0]
|
[7 3 2 1 0]
|
9 | 511 |
[9 4 0]
|
[9 6 4 3 0]
|
10 | 1023 |
[10 3 0]
|
[10 8 3 2 0]
|
11 | 2047 |
[11 2 0]
|
[11 8 5 2 0]
|
The Initial states (1) and Initial states (2) parameters are vectors specifying the initial values of the registers corresponding to Preferred polynomial (1) and Preferred polynomial (2), respectively. These parameters must satisfy these criteria:
All elements of the Initial states (1) and Initial states (2) vectors must be binary numbers.
The length of the Initial states (1) vector must equal the degree of the Preferred polynomial (1), and the length of the Initial states (2) vector must equal the degree of the Preferred polynomial (2).
Note
At least one element of the initial states vectors ( Initial states (1) or Initial states (2)) must be nonzero in order for the block to generate a nonzero sequence. Specifically, the initial state of at least one of the registers must be nonzero.
The Sequence index parameter specifies which Gold sequence in the set G(u, v) is output. The range of Sequence index is [–2, –1, 0, 1, 2, ..., 2n–2], where n is the degree of the generator polynomials specified by the Preferred polynomial (1) and Preferred polynomial (2) parameters. This table shows the correspondence between Sequence index and the output sequence.
Sequence Index | Output Sequence |
---|---|
–2 | u |
–1 | v |
0 |
|
1 |
|
2 |
|
... | ... |
2 n –2 |
|
T represents the operator that shifts vectors cyclically to the left by one place, and represents addition modulo 2.
You can shift the starting point of the Gold sequence with the Shift parameter, which is an integer representing the length of the shift.
You can use an external signal to reset the values of the internal shift register to the initial state by selecting Reset on nonzero input. This creates an input port for the external signal in the Gold Sequence Generator block. The way the block resets the internal shift register depends on whether its output signal and the reset signal are scalar or vector. For more information, see Reset Behavior.
To reset the generator sequence, you must first select Reset on nonzero input to add the Rst
input. Suppose that the Gold Sequence Generator block outputs [1 0 0 1 1 0 1 1]
when there is no reset. The following table shows the effect on the Gold Sequence Generator block output for the property values indicated.
Reset Signal Properties | Gold Sequence Generator block | Reset Signal Output Signal | |
---|---|---|---|
No reset | Sample time =
Samples per
frame =
Rst =
| Sample time =
Samples per
frame =
Out =
|
|
Scalar reset signal | Sample time =
Samples per
frame =
Rst =
| Sample time =
Samples per
frame = |
|
Vector reset signal | Sample time =
Samples per
frame =
Rst =
| Sample time =
Samples per
frame = |
For the no reset case, the sequence is output without being reset. For the
scalar and vector reset signal cases, the reset signal [0 0 0 1 0 0 0 0]
is input to the Rst
port. The sequence output is reset at the fourth
bit, because the fourth bit of the reset signal is a 1 and the Sample
time is 1.
For variable-sized outputs, the block only supports scalar reset signal inputs.
The Gold Sequence Generator Reset Behavior example demonstrates the reset behavior in a Simulink® model.
The requirements for a pair of sequences u, v of period N = 2n–1 to be a preferred pair are as follows:
n is not divisible by 4
v = u[q], where
q is odd
q = 2k+1 or q = 22k–2k+1
v is obtained by sampling every qth symbol of u
Behavior changed in R2020a
Starting in R2020a, Simulink no longer allows you to use the Gold Sequence Generator block version available before R2015b.
Existing models automatically update to load the Gold Sequence Generator block version announced in Source blocks output frames of contiguous time samples but do not use the frame attribute in the R2015b Release Notes. For more information on block forwarding, see Forwarding Tables (Simulink).
[1] Proakis, John G. Digital Communications 3rd ed. New York: McGraw Hill, 1995.
[2] Gold, R. “Maximal Recursive Sequences with 3-Valued Recursive Cross-Correlation Functions (Corresp.).” IEEE Transactions on Information Theory 14, no. 1 (January 1968): 154–56. https://doi.org/10.1109/TIT.1968.1054106.
[3] Gold, R. “Optimal Binary Sequences for Spread Spectrum Multiplexing (Corresp.).” IEEE Transactions on Information Theory 13, no. 4 (October 1967): 619–21. https://doi.org/10.1109/TIT.1967.1054048.
[4] Sarwate, D.V., and M.B. Pursley, "Crosscorrelation Properties of Pseudorandom and Related Sequences," Proc. IEEE , Vol. 68, No. 5, May, 1980, pp. 583-619.
[5] Dixon, Robert C. Spread Spectrum Systems: With Commercial Applications. 3rd ed. New York: Wiley, 1994.