Barker Code Generator

Generate Barker Code


Sequence Generators sublibrary of Comm Sources


Barker codes, which are subsets of PN sequences, are commonly used for frame synchronization in digital communication systems. Barker codes have length at most 13 and have low correlation sidelobes. A correlation sidelobe is the correlation of a codeword with a time-shifted version of itself. The correlation sidelobe, Ck, for a k-symbol shift of an N-bit code sequence, {Xj}, is given by


where Xj is an individual code symbol taking values +1 or -1 for j=1, 2, 3,..., N, and the adjacent symbols are assumed to be zero.

The Barker Code Generator block provides the codes listed in the following table:

Code lengthBarker Code
1 [-1]
2 [-1 1];
3 [-1 -1 1]
4 [-1 -1 1 -1]
5 [-1 -1 -1 1 -1]
7 [-1 -1 -1 1 1 -1 1]
11 [-1 -1 -1 1 1 1 -1 1 1 -1 1]
13 [-1 -1 -1 -1 -1 1 1 -1 -1 1 -1 1 -1]


Code length

The length of the Barker code.

Sample time

The time between each sample of the output signal.

Samples per frame

The number of samples in one column of the output signal.


The time between output updates is equal to the product of Samples per frame and Sample time. For example, if Sample time and Samples per frame equal one, the block outputs a sample every second. If Samples per frame is increased to 10, then a 10-by-1 vector is output every 10 seconds. This ensures that the equivalent output rate is not dependent on the Samples per frame parameter.

Output data type

The output type of the block can be specified as an int8 or double. By default, the block sets this to double.

Simulate using

Select the simulation mode.

Code generation

On the first model run, simulate and generate code. If the structure of the block does not change, subsequent model runs do not regenerate the code.

If the simulation mode is Code generation, System objects corresponding to the blocks accept a maximum of nine inputs.

Interpreted execution

Simulate model without generating code. This option results in faster start times but can slow subsequent simulation performance.

Extended Capabilities

See Also


Introduced before R2006a