Main Content

Barker Code Generator

Generate bipolar Barker Code

  • Barker Code Generator block

Communications Toolbox
Communications Toolbox / Comm Sources / Sequence Generators


The Barker Code Generator block generates a bipolar Barker code. The short length and low correlation sidelobes make Barker codes useful for frame synchronization in digital communications systems. For more information, see Barker Codes.



expand all

Barker code frame, returned as a column vector. If the frame length exceeds the Barker code length, the block fills the frame by repeating the Barker code.


Set the data type of the output with the Output data type parameter.


expand all

Length of the generated code, specified as 1, 2, 3, 4, 5, 7, 11, or 13. For more information, see Barker Codes.

Example: 2 outputs the Barker code [–1;1].

Positive scalars specify the time in seconds between each sample of the output signal. If you set the sample time to -1, the output signal inherits the sample time from downstream. For information on the relationship between the Sample time and Samples per frame parameters, see Sample Timing.

Samples per output frame, specified as a positive integer. If Samples per frame is M, the block outputs a frame containing M samples comprised of length N Barker code sequences. N is the length of the generated code, which is set by the Code length parameter. When M is not an integer multiple of N, consecutive frames maintain continuity of the Barker code across frame boundaries.

For information on the relationship between Sample time and Samples per frame, see Sample Timing.

Output data type, specified as double or int8.

Type of simulation to run, specified as Code generation or Interpreted execution.

  • Code generation — Simulate the model by using generated C code. The first time you run a simulation, Simulink® generates C code for the block. The model reuses the C code for subsequent simulations unless the model changes. This option requires additional startup time, but the speed of the subsequent simulations is faster than with the Interpreted execution option.

  • Interpreted execution — Simulate the model by using the MATLAB® interpreter. This option shortens startup time, but the speed of subsequent simulations is slower than with the Code generation option. In this mode, you can debug the source code of the block.

For more information, see Simulation Modes (Simulink).

Block Characteristics

Data Types

double | integer

Multidimensional Signals


Variable-Size Signals


More About

expand all

Extended Capabilities

Version History

Introduced before R2006a

expand all