MLS are generated using maximal linear-feedback shift registers. An MLS-generating system with a shift register of length 4 is shown in Fig. 1. It can be expressed using the following recursive relation:
where n is the time index and + {\displaystyle +} represents modulo-2 addition. For bit values 0 = FALSE or 1 = TRUE, this is equivalent to the XOR operation.
As MLS are periodic and shift registers cycle through every possible binary value (with the exception of the zero vector), registers can be initialized to any state, with the exception of the zero vector.
A polynomial over GF(2) can be associated with the linear-feedback shift register. It has degree of the length of the shift register, and has coefficients that are either 0 or 1, corresponding to the taps of the register that feed the xor gate. For example, the polynomial corresponding to Figure 1 is x 4 + x + 1 {\displaystyle x^{4}+x+1} .
A necessary and sufficient condition for the sequence generated by a LFSR to be maximal length is that its corresponding polynomial be primitive.3
MLS are inexpensive to implement in hardware or software, and relatively low-order feedback shift registers can generate long sequences; a sequence generated using a shift register of length 20 is 220 − 1 samples long (1,048,575 samples).
MLS have the following properties, as formulated by Solomon Golomb.4
The occurrence of 0 and 1 in the sequence should be approximately the same. More precisely, in a maximum length sequence of length 2 n − 1 {\displaystyle 2^{n}-1} there are 2 n − 1 {\displaystyle 2^{n-1}} ones and 2 n − 1 − 1 {\displaystyle 2^{n-1}-1} zeros. The number of ones equals the number of zeros plus one, since the state containing only zeros cannot occur.
A "run" is a sub-sequence of consecutive "1"s or consecutive "0"s within the MLS concerned. The number of runs is the number of such sub-sequences.
Of all the "runs" (consisting of "1"s or "0"s) in the sequence :
The circular autocorrelation of an MLS is a Kronecker delta function56 (with DC offset and time delay, depending on implementation). For the ±1 convention, i.e., bit value 1 is assigned s = + 1 {\displaystyle s=+1} and bit value 0 s = − 1 {\displaystyle s=-1} , mapping XOR to the negative of the product:
R ( n ) = 1 N ∑ m = 1 N s [ m ] s ∗ [ m + n ] N = { 1 if n = 0 , − 1 N if 0 < n < N . {\displaystyle R(n)={\frac {1}{N}}\sum _{m=1}^{N}s[m]\,s^{*}[m+n]_{N}={\begin{cases}1&{\text{if }}n=0,\\-{\frac {1}{N}}&{\text{if }}0<n<N.\end{cases}}}
where s ∗ {\displaystyle s^{*}} represents the complex conjugate and [ m + n ] N {\displaystyle [m+n]_{N}} represents a circular shift.
The linear autocorrelation of an MLS approximates a Kronecker delta.
If a linear time invariant (LTI) system's impulse response is to be measured using a MLS, the response can be extracted from the measured system output y[n] by taking its circular cross-correlation with the MLS. This is because the autocorrelation of a MLS is 1 for zero-lag, and nearly zero (−1/N where N is the sequence length) for all other lags; in other words, the autocorrelation of the MLS can be said to approach unit impulse function as MLS length increases.
If the impulse response of a system is h[n] and the MLS is s[n], then
Taking the cross-correlation with respect to s[n] of both sides,
and assuming that φss is an impulse (valid for long sequences)
Any signal with an impulsive autocorrelation can be used for this purpose, but signals with high crest factor, such as the impulse itself, produce impulse responses with poor signal-to-noise ratio. It is commonly assumed that the MLS would then be the ideal signal, as it consists of only full-scale values and its digital crest factor is the minimum, 0 dB.78 However, after analog reconstruction, the sharp discontinuities in the signal produce strong intersample peaks, degrading the crest factor by 4-8 dB or more, increasing with signal length, making it worse than a sine sweep.9 Other signals have been designed with minimal crest factor, though it is unknown if it can be improved beyond 3 dB.10
Cohn and Lempel11 showed the relationship of the MLS to the Hadamard transform. This relationship allows the correlation of an MLS to be computed in a fast algorithm similar to the FFT.
Gemba, Kay L.; Vazquez, Heriberto J.; Fialkowski, Joseph; Edelmann, Geoffrey F.; Dzieciuch, Matthew A.; Hodgkiss, William S. (October 2021). "A performance comparison between m-sequences and linear frequency-modulated sweeps for the estimation of travel-time with a moving source". The Journal of the Acoustical Society of America. 150 (4): 2613–2623. Bibcode:2021ASAJ..150.2613G. doi:10.1121/10.0006656. PMID 34717519. S2CID 240355915. https://asa.scitation.org/doi/10.1121/10.0006656 ↩
Buracas GT, Boynton GM (July 2002). "Efficient design of event-related fMRI experiments using M-sequences". NeuroImage. 16 (3 Pt 1): 801–13. doi:10.1006/nimg.2002.1116. PMID 12169264. S2CID 7433120. /wiki/Doi_(identifier) ↩
"Linear Feedback Shift Registers-Implementation, M-Sequence Properties, Feedback Tables"[1], New Wave Instruments (NW), Retrieved 2013.12.03. http://www.newwaveinstruments.com/resources/articles/m_sequence_linear_feedback_shift_register_lfsr.htm ↩
Golomb, Solomon W. (1967). Shift register sequences. Holden-Day. ISBN 0-89412-048-4. 0-89412-048-4 ↩
Jacobsen, Finn; Juhl, Peter Moller (2013-06-04). Fundamentals of General Linear Acoustics. John Wiley & Sons. ISBN 978-1118636176. A maximum-length sequence is a binary sequence whose circular autocorrelation (except for a small DC-error) is a delta function. 978-1118636176 ↩
Sarwate, D. V.; Pursley, M. B. (1980-05-01). "Crosscorrelation properties of pseudorandom and related sequences". Proceedings of the IEEE. 68 (5): 593–619. doi:10.1109/PROC.1980.11697. ISSN 0018-9219. S2CID 6179951. /wiki/Doi_(identifier) ↩
"A Little MLS (Maximum-Length Sequence) Tutorial | dspGuru.com". dspguru.com. Retrieved 2016-05-19. its RMS and peak values are both X, making its crest factor (peak/RMS) equal to 1, the lowest it can get. http://dspguru.com/dsp/tutorials/a-little-mls-tutorial ↩
"Other Electro-Acoustical Measurement Techniques". www.clear.rice.edu. Retrieved 2016-05-19. The crest factor for MLS is very close to 1, so it makes sense to use this kind of input signal when we need a high signal-to-noise ratio for our measurement https://www.clear.rice.edu/elec301/Projects00/elec301/OtherTechniques/othertechniques.html ↩
Chan, Ian H. "Swept Sine Chirps for Measuring Impulse Response" (PDF). thinksrs.com. Retrieved 2016-05-19. Maximum-length sequence (MLS) theoretically fits the bill because it has a mathematical crest factor of 0dB, the lowest crest factor possible. However, in practice, the sharp transitions and bandwidth-limited reproduction of the signal result in a crest factor of about 8dB http://www.thinksrs.com/downloads/PDFs/ApplicationNotes/SR1_SweptSine.pdf ↩
Friese, M. (1997-10-01). "Multitone signals with low crest factor" (PDF). IEEE Transactions on Communications. 45 (10): 1338–1344. doi:10.1109/26.634697. ISSN 0090-6778. https://stanford.edu/~boyd/papers/pdf/multitone_low_crest.pdf ↩
Cohn, M.; Lempel, A. (January 1977). "On Fast M-Sequence Transforms". IEEE Trans. Inf. Theory. 23 (1): 135–7. doi:10.1109/TIT.1977.1055666. /wiki/Doi_(identifier) ↩