There is once a function called 'mlbs' in Matlab but no longer included. The
description of it can be found at
The contributed function is a mimic of the 'mlbs' function.
Now only LFSR lengths of 2 to 32 are supported. However, further support up to
length of 168 can be added. Please refer to
Generate maximum length binary sequence (pseudo-random binary sequence).
bitseries = mlbs(log2N)
[bitseries,nextstnum] = mlbs(log2N,bitno,startnum)
mlbs generates a maximum length binary sequence (column vector bitseries),
a shift register of length log2N. The minimum value of the argument log2N is 2,
the maximum value is 30. The length of the generated sequence is given by
that is, a partial sequence can also be generated. The default value of bitno
2^log2N-1, that is, the full length of the PRBS with the given register length.
The generation is based on a binary shift register with modulo 2 feedback. The
starting value of the register is startnum. The register contents can be
obtained via nextstnum, which can be used for the continuation of the sequence
Default Argument Values
bitno = 2^log2N-1, startnum = 2^log2N-1
bitseries = mlbs(10); %Length: N = 1023 = 2^10-1
The register length must be an integer number between the allowed minimum and
maximum, otherwise an error message is sent:
log2N is not integer
log2N = ... is not allowed
startnum must be between 1 and 2log2N-1, otherwise the error message is
startnum out of range
The feedback shift register is implemented in a MATLAB vector, according to the
definition (see ).
 K. R. Godfrey, ed.: Perturbation Signals for System Identification.
Englewood Cliffs, Prentice-Hall, 1993.