There are
several recursion relations that may be used to generate an MLS.
We will not derive these, rather we will use the simplest (and therefore
most computationally efficient) available. As an example, consider a shift
register of elements. The recursion
relation we use is directly related to the primitive polynomial [69]
(7.3) |
In order to generate an MLS in practice we have to specify an initial state for the memory elements. Here we will use 1111. The last and second last elements are both 1, so the sum is 2, which when taken modulo 2 gives a result of 0 for the left hand element at the next step. The other elements shift one step to the right, giving 0111 as the next state of the four elements, and the 1 which exited on the right is the first term in the output sequence.
Table 7.1 shows the state of the memory element group at each time step and the MLS can be seen building up vertically down the right hand column. The MLS sequence appears random, but repeats with a period of 15. In fact, the element group takes every binary value possible except 0000 which would be a dead end for the sequence since a 1 would never be generated. The number of possible values for a binary number with digits is so the maximum length for an MLS signal must therefore be , hence the name maximum length sequence. It follows that the initial state is unimportant to the properties of the MLS signal (as long as 0000 is not taken) since the sequence covers all non-zero states and is periodic.
For other values of , the only difference in the method for generating an MLS is that we use memory elements and we must use a different primitive polynomial, of order . The polynomials up to are listed by Stahnke [69] and are shown in recursion relation form up to in table 7.2. The length of an sequence is samples which corresponds to over 23 seconds of sound when played as an acoustic signal at 44.1 kHz.