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.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Generate Gold sequence from set of sequences

Sequence Generators sublibrary of Comm Sources

The Gold Sequence Generator block generates a Gold sequence. Gold sequences form a large class of sequences that have good periodic cross-correlation properties.

This block can output sequences that vary in length during simulation.
For more information about variable-size signals, see Variable-Size Signal Basics (Simulink) in
the Simulink^{®} documentation.

The Gold sequences are defined using a specified pair of sequences *u* and *v*,
of period *N* = 2^{n} -
1, called a *preferred pair*, as defined in Preferred Pairs of Sequences below. The set *G*(*u,
v*) of Gold sequences is defined by

$$G(u,v)=\{u,v,u\oplus v,u\oplus Tv,u\oplus {T}^{2}v,\mathrm{...},u\oplus {T}^{N-1}v\}$$

where *T* represents the operator that shifts
vectors cyclically to the left by one place, and $$\oplus $$ represents addition modulo 2.
Note that G(u,v) contains *N* + 2 sequences of
period *N*. The Gold Sequence Generator block outputs
one of these sequences according to the block's parameters.

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

$$t(n)=\{\begin{array}{ll}1+{2}^{(n+1)/2}\hfill & n\text{even}\hfill \\ 1+{2}^{(n+2)/2}\hfill & n\text{odd}\hfill \end{array}$$

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 character vector `'z^5 + z^2 + 1'`

,
the vector `[5 2 0]`

, and the vector ```
[1
0 0 1 0 1]
```

represent the polynomial *z*^{5} + *z*^{2} +
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 must be nonzero in order for the block to generate a nonzero sequence. That is, the initial state of at least one of the registers must be nonzero.

The **Sequence index** parameter specifies
which sequence in the set *G*(*u, v*)
of Gold sequences the block outputs. The range of **Sequence
index** is [-2, -1, 0, 1, 2, ..., 2^{n}–2].
The correspondence between **Sequence index** and
the output sequence is given in the following table.

Sequence Index | Output Sequence |
---|---|

-2 | u |

-1 | v |

0 | $$u\oplus v$$ |

1 | $$u\oplus Tv$$ |

2 | $$u\oplus {T}^{2}v$$ |

... | ... |

2^{n}-2 | $$u\oplus {T}^{{2}^{n}-2}v$$ |

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 sample-based or frame-based. The following example
demonstrates the possible alternatives. See Example: Resetting a Signal for
an example.

The requirements for a pair of sequences *u*, *v* of
period N = 2^{n}–1 to be a preferred
pair are as follows:

n is not divisible by 4

v = u[q], where

*q*is oddq = 2

^{k}+1 or q = 2^{2k}–2^{k}+1v is obtained by sampling every qth symbol of u

$$\mathrm{gcd}(n,k)=\{\begin{array}{cc}1& n\equiv 1\mathrm{mod}2\\ 2& n\equiv 2\mathrm{mod}4\end{array}$$

**Preferred polynomial[1]**Character vector or vector specifying the polynomial for the first sequence of the preferred pair.

**Initial states[1]**Vector of initial states of the shift register for the first sequence of the preferred pair.

**Preferred polynomial[2]**Character vector or vector specifying the polynomial for the second sequence of the preferred pair.

**Initial states[2]**Vector of initial states of the shift register for the second sequence of the preferred pair.

**Sequence index**Integer specifying the index of the output sequence from the set of sequences.

**Shift**Integer scalar that determines the offset of the Gold sequence from the initial time.

**Output variable-size signals**Select this check box if you want the output sequences to vary in length during simulation. The default selection outputs fixed-length signals.

**Maximum output size source**Specify how the block defines maximum output size for a signal.

When you select

`Dialog parameter`

, the value you enter in the**Maximum output size**parameter specifies the maximum size of the output. 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 must be less than or equal to the**Maximum output size**parameter.When you select

`Inherit from reference port`

, the block output inherits sample time, maximum size, and current size from the variable-sized signal at the Ref input port.

This parameter only appears when you select

**Output variable-size signals**. The default selection is`Dialog parameter`

.**Maximum output size**Specify a two-element row vector denoting the maximum output size for the block. The second element of the vector must be

`1`

For example, [10 1] gives a 10-by-1 maximum sized output signal. This parameter only appears when you select**Output variable-size signals**.**Sample time**The time between each sample of a column of the output signal.

**Samples per frame**The number of samples per frame in one channel of the output signal.

**Note:**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.**Reset on nonzero input**When selected, you can specify an input signal that resets the internal shift registers to the original values of the

**Initial states**parameter**Output data type**The output type of the block can be specified as

`boolean`

,`double`

or`Smallest unsigned integer`

. By default, the block sets this to`double`

.When the parameter is 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, i.e., 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 (e.g., uint8).

[1] Proakis, John G., *Digital Communications*,
Third edition, New York, McGraw Hill, 1995.

[2] Gold, R., "Maximal Recursive Sequences
with 3-valued Recursive Cross-Correlation Functions," *IEEE
Trans. Infor. Theory*, Jan., 1968, pp. 154-156.

[3] Gold, R., "Optimal Binary Sequences for
Spread Spectrum Multiplexing, *IEEE Trans. Infor. Theory*,
Oct., 1967, pp. 619-621.

[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, *Spread Spectrum
Systems with Commercial Applications*, Third Edition,
Wiley–Interscience, 1994.

Was this topic helpful?