File Exchange

## mls.m

version 1.0.0.0 (1.37 KB) by Christopher Brown

### Christopher Brown (view profile)

Generates maximum length sequences, which are pseudorandom noises useful for acoustic measurements.

Updated 18 Jan 2002

Function can accept bit lengths of between 2 and 24

y is a vector of 1's & -1's that is (2^n)-1 in length.

### Cite As

Christopher Brown (2019). mls.m (https://www.mathworks.com/matlabcentral/fileexchange/1246-mls-m), MATLAB Central File Exchange. Retrieved .

Caesar Kurnia

Tobias

### Tobias (view profile)

Well, good one. But there is a mistake in my opinion: You didn't pay attention to the fact that 1's and 0's have to be in a row. For example: with n and length (2^n-1):
1 - time : A n-digit sequence of 1s
1 - time : A (n-1)-digit sequence of 0s
each 1-time: (n-1)-digit sequence of 1s and 0s
....
Please correct me if I am wrong, but I get a m-sequence for
n = 2: [-1 1 -1] which is wrong !
and
n=3: [1 -1 1 -1 -1 -1 1] which isn't correct either !

Tobias

Jonathan

### Jonathan (view profile)

Great stuff. Executed quickly even for larger register lengths (Took 40 seconds for n=17 using Octave). Completely octave compatible, no changes necessary.

Apologies if the star rating doesn't come out right (should be 5, but the site is doing some weird things).

Wa Yuen

very efficient code

Tim Streeter

I apologize... I made a mistake in the stating that there is an error in the primitive polynomial list. Those tap lists are correct.

Tim Streeter

There are couple issues with this MLS sequence generator. The primitive polynomial list has a few errors (lines 29-180). This list is not necessary given that Matlab has a built in function to generate these (gfprimdf.m) For example, the 7th order MLS
sequence output is incorrect. Given the use of the tap list, this code is slightly inefficient.

Lukasz Panek

this tool works fine and is easy to use.

Basile Graf

Just what you expect from it. Thanx.

Cristian Gutiérrez

Excellent code for a binary pseudorandom sequence generation.
The use of MLS forms a powerful method for the accurate determination of Impulse Response in LTI system.

##### MATLAB Release Compatibility
Created with R11
Compatible with any release
##### Platform Compatibility
Windows macOS Linux