Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Maximum length sequence
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Type of pseudorandom binary sequence}} {{Use American English|date = March 2019}} A '''maximum length sequence''' ('''MLS''') is a type of [[pseudorandom binary sequence]]. They are bit sequences generated using maximal [[linear-feedback shift register]]s and are so called because they are [[periodic function|periodic]] and reproduce every [[binary sequence]] (except the zero vector) that can be represented by the shift registers (i.e., for length-''m'' registers they produce a sequence of length 2<sup>''m''</sup> − 1). An MLS is also sometimes called an '''n-sequence''' or an '''m-sequence'''. MLSs are [[Frequency spectrum|spectrally flat]], with the exception of a near-zero DC term. These sequences may be represented as coefficients of irreducible polynomials in a [[polynomial ring]] over [[Congruence subgroup|Z/2Z]]. Practical applications for MLS include measuring [[impulse response]]s (e.g., of room [[reverberation]] or arrival times from towed sources in the ocean<ref>{{Cite journal |last1=Gemba |first1=Kay L. |last2=Vazquez |first2=Heriberto J. |last3=Fialkowski |first3=Joseph |last4=Edelmann |first4=Geoffrey F. |last5=Dzieciuch |first5=Matthew A. |last6=Hodgkiss |first6=William S. |date=October 2021 |title=A performance comparison between m-sequences and linear frequency-modulated sweeps for the estimation of travel-time with a moving source |url=https://asa.scitation.org/doi/10.1121/10.0006656 |journal=The Journal of the Acoustical Society of America |language=en |volume=150 |issue=4 |pages=2613β2623 |doi=10.1121/10.0006656 |pmid=34717519 |bibcode=2021ASAJ..150.2613G |s2cid=240355915 }}</ref>). They are also used as a basis for deriving pseudo-random sequences in digital communication systems that employ [[direct-sequence spread spectrum]] and [[frequency-hopping spread spectrum]] [[transmission system]]s, and in the efficient design of some [[Functional magnetic resonance imaging|fMRI]] experiments.<ref name="buracas">{{cite journal |author=Buracas GT, Boynton GM |title=Efficient design of event-related fMRI experiments using M-sequences |journal=NeuroImage |volume=16 |issue=3 Pt 1 |pages=801β13 |date=July 2002 |pmid=12169264 |doi=10.1006/nimg.2002.1116 |s2cid=7433120 }}</ref> ==Generation== [[File:MLS shiftregisters L4.png|thumbnail|350px|right|Figure 1: The next value of register ''a''<sub>3</sub> in a feedback shift register of length 4 is determined by the modulo-2 sum of ''a''<sub>0</sub> and ''a''<sub>1</sub>.]] MLS are generated using maximal [[linear-feedback shift register]]s. 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: :<math>\begin{cases} a_3[n+1] = a_0[n] + a_1[n]\\ a_2[n+1] = a_3[n] \\ a_1[n+1] = a_2[n] \\ a_0[n+1] = a_1[n] \\ \end{cases} </math> where ''n'' is the time index and <math>+</math> represents [[Modular arithmetic|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. ===Polynomial interpretation=== A [[polynomial]] over [[Galois field|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 <math>x^4+x+1</math>. A necessary and sufficient condition for the sequence generated by a LFSR to be maximal length is that its corresponding polynomial be [[Primitive polynomial (field theory)|primitive]].<ref>"Linear Feedback Shift Registers-Implementation, M-Sequence Properties, Feedback Tables"[http://www.newwaveinstruments.com/resources/articles/m_sequence_linear_feedback_shift_register_lfsr.htm], New Wave Instruments (NW), Retrieved 2013.12.03.</ref> ===Implementation=== 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 2<sup>20</sup> − 1 samples long (1,048,575 samples). ==Properties of maximum length sequences== MLS have the following properties, as formulated by [[Solomon Golomb]].<ref name="golumb">{{cite book |first=Solomon W. |last=Golomb |title=Shift register sequences |url=https://books.google.com/books?id=LqtMAAAAMAAJ |year=1967 |publisher=Holden-Day |isbn=0-89412-048-4}}</ref> ===Balance property=== The occurrence of 0 and 1 in the sequence should be approximately the same. More precisely, in a maximum length sequence of length <math>2^n-1</math> there are <math>2^{n-1}</math> ones and <math>2^{n-1}-1</math> zeros. The number of ones equals the number of zeros plus one, since the state containing only zeros cannot occur. ===Run property=== 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. {{vague|date=February 2018}} Of all the "runs" (consisting of "1"s or "0"s) in the sequence : * One half of the runs are of length 1. * One quarter of the runs are of length 2. * One eighth of the runs are of length 3. * ... etc. ... ===Correlation property=== The circular [[autocorrelation]] of an MLS is a [[Kronecker delta]] function<ref>{{Cite book|url=https://books.google.com/books?id=Sq6uFqlHg1gC|title=Fundamentals of General Linear Acoustics|last1=Jacobsen|first1=Finn|last2=Juhl|first2=Peter Moller|date=2013-06-04|publisher=John Wiley & Sons|isbn=978-1118636176|language=en|quote=A maximum-length sequence is a binary sequence whose circular autocorrelation (except for a small DC-error) is a delta function.}}</ref><ref>{{Cite journal|last1=Sarwate|first1=D. V.|last2=Pursley|first2=M. B.|date=1980-05-01|title=Crosscorrelation properties of pseudorandom and related sequences|journal=Proceedings of the IEEE|volume=68|issue=5|pages=593β619|doi=10.1109/PROC.1980.11697|s2cid=6179951 |issn=0018-9219}}</ref> (with DC offset and time delay, depending on implementation). For the Β±1 convention, i.e., bit value 1 is assigned <math>s = +1</math> and bit value 0 <math>s = -1</math>, mapping XOR to the negative of the product: <math>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}</math> where <math>s^*</math> represents the complex conjugate and <math>[m+n]_N</math> represents a [[circular shift]]. The linear autocorrelation of an MLS approximates a Kronecker delta. ==Extraction of impulse responses== If a [[LTI system theory|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 :<math>y[n] = (h*s)[n].\,</math> Taking the cross-correlation with respect to ''s''[''n''] of both sides, :<math>{\phi}_{sy} = h[n]*{\phi}_{ss}\,</math> and assuming that Ο<sub>''ss''</sub> is an impulse (valid for long sequences) :<math>h[n] = {\phi}_{sy}.\,</math> <!-- had to do the above in a rush. not entirely accurate!-->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.<ref>{{Cite web|url=http://dspguru.com/dsp/tutorials/a-little-mls-tutorial|title=A Little MLS (Maximum-Length Sequence) Tutorial {{!}} dspGuru.com|website=dspguru.com|access-date=2016-05-19|quote=its RMS and peak values are both X, making its crest factor (peak/RMS) equal to 1, the lowest it can get.}}</ref><ref>{{Cite web|url=https://www.clear.rice.edu/elec301/Projects00/elec301/OtherTechniques/othertechniques.html|title=Other Electro-Acoustical Measurement Techniques|website=www.clear.rice.edu|access-date=2016-05-19|quote=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}}</ref> However, after [[Digital-to-analog converter|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.<ref>{{Cite web |last=Chan |first=Ian H. |title=Swept Sine Chirps for Measuring Impulse Response |url=http://www.thinksrs.com/downloads/PDFs/ApplicationNotes/SR1_SweptSine.pdf |access-date=2016-05-19 |website=thinksrs.com |quote=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}}</ref> Other signals have been designed with minimal crest factor, though it is unknown if it can be improved beyond 3 dB.<ref>{{Cite journal|last=Friese|first=M.|date=1997-10-01|title=Multitone signals with low crest factor|url=https://stanford.edu/~boyd/papers/pdf/multitone_low_crest.pdf|journal=IEEE Transactions on Communications|volume=45|issue=10|pages=1338β1344|doi=10.1109/26.634697|issn=0090-6778}}</ref> ==Relationship to Hadamard transform== Cohn and Lempel<ref name="cohn">{{cite journal |last1=Cohn |first1=M. |last2=Lempel |first2=A. |title=On Fast M-Sequence Transforms |journal=IEEE Trans. Inf. Theory |volume=23 |issue=1 |pages=135β7 |date=January 1977 |doi=10.1109/TIT.1977.1055666 }}</ref> 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 [[Fast Fourier transform|FFT]]. ==See also== * [[Barker code]] * [[Complementary sequences]] * [[Federal Standard 1037C]] * [[Frequency response]] * [[Gold code]] * [[Impulse response]] * [[Polynomial ring]] ==References== *{{cite book |first1=Solomon W. |last1=Golomb |author2=Guang Gong|author2-link=Guang Gong |title=Signal Design for Good Correlation: For Wireless Communication, Cryptography, and Radar |url=https://books.google.com/books?id=DhYXL4miZj4C |year=2005 |publisher=[[Cambridge University Press]] |isbn=978-0-521-82104-9}} {{reflist}} ==External links== * {{cite web |last=Bristow-Johnson |first=Robert |title=A Little MLS Tutorial |url=http://www.dspguru.com/dsp/tutorials/a-little-mls-tutorial }} β Short on-line tutorial describing how MLS is used to obtain the [[impulse response]] of a [[linear time-invariant system]]. Also describes how nonlinearities in the system can show up as spurious spikes in the apparent impulse response. * {{cite web |first=Jens |last=Hee |title=Impulse response measurement using MLS |url=http://jenshee.dk/signalprocessing/mls.pdf}} β Paper describing MLS generation. Contains C-code for MLS generation using up to 18-tap-LFSRs and matching Hadamard transform for impulse response extraction. *{{cite web |first=Magnus |last=SchΓ€fer |title=Aachen Impulse Response Database |date=October 2012 |publisher=Institute of Communication Systems and Data Processing, RWTH Aachen University |url=http://www.ind.rwth-aachen.de/en/research/tools-downloads/aachen-impulse-response-database/ |id=V1.4}} A (binaural) room impulse response database generated by means of maximum length sequences. *{{cite web |id=XAPP052 v1.1 |title=Efficient Shift Registers, LFSR Counters, and Long Pseudo-Random Sequence Generators β Obsolete |date=July 1996 |publisher=Xilinx |url=http://www.xilinx.com/support/documentation/application_notes/xapp052.pdf}} β Implementing lfsr's in FPGAs includes listing of taps for 3 to 168 bits [[Category:Pseudorandomness]] [[Category:Polynomials]] [[Category:Binary sequences]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Cite book
(
edit
)
Template:Cite journal
(
edit
)
Template:Cite web
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Use American English
(
edit
)
Template:Vague
(
edit
)