Main Content

Barker Code Generator

Generate bipolar Barker Code

  • Library:
  • Communications Toolbox

    Communications Toolbox / Comm Sources / Sequence Generators

  • Barker Code Generator block


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].

Data Types: double

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.

Data Types: double

Output data type, specified as double or int8.

Data Types: char | string

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 C code is reused for subsequent simulations unless the model changes. This option requires additional startup time, but the speed of the subsequent simulations is faster than Interpreted execution.

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

Block Characteristics

Data Types

double | integer

Multidimensional Signals


Variable-Size Signals


More About

expand all

Extended Capabilities

Version History

Introduced before R2006a

expand all