File : Details

# MLBS(PRBS) generator function

A function that generates PseudoRandom Binary Sequence
Details
Version
1.0
Author
Bibo Yang
Maintainer
Bibo Yang
Category
Supported Scilab Version
4.1
Creation Date
May 27, 2010
Description
```            There is once a function called 'mlbs' in Matlab but no longer included. The
description of it can be found at
http://dali.feld.cvut.cz/ucebna/matlab/toolbox/fdident/mlbs.html
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
http://www.xilinx.com/support/documentation/application_notes/xapp052.pdf

mlbs

Generate maximum length binary sequence (pseudo-random binary sequence).

Syntax

bitseries  = mlbs(log2N)
[bitseries,nextstnum] = mlbs(log2N,bitno,startnum)

Description
mlbs generates a maximum length binary sequence (column vector bitseries),
using
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
bitno,
that is, a partial sequence can also be generated. The default value of bitno
is
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
generation.

Default Argument Values

bitno = 2^log2N-1, startnum = 2^log2N-1

Examples

bitseries = mlbs(10); %Length: N = 1023 = 2^10-1

Diagnostics
The register length must be an integer number between the allowed minimum and
maximum, otherwise an error message is sent:

log2N is not integer

or

log2N = ... is not allowed

startnum must be between 1 and 2log2N-1, otherwise the error message is

startnum out of range

Algorithm
The feedback shift register is implemented in a MATLAB vector, according to the
definition (see [1]).

```