Generate bipolar Barker Code
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.
output
— Barker code frameBarker 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.
Code length
— Length of generated code7
(default) | 1
| 2
| 3
| 4
| 5
| 11
| 13
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
Sample time
— Output sample time1
(default) | -1 | positive scalarOutput sample time, specified as -1
or a
positive scalar that represents the time between each sample of the output signal. If
Sample time is set to -1
, the sample time is
inherited from downstream. For information on the relationship between Sample
time and Samples per frame, see
Sample Timing.
Samples per frame
— Samples per output frame1
(default) | positive integerSamples 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
— Output data typedouble
(default) | int8
Output data type, specified as double
or
int8
.
Data Types: char
| string
Simulate using
— Type of simulation to runCode generation
(default) | Interpreted execution
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
method, but the speed of
subsequent simulations is slower. In this mode, you can debug the source
code of the block.
Data Types |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Barker codes have a maximum autocorrelation sequence, which has off-peak autocorrelations no larger than 1.
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
For j=1, 2, 3,..., N, Xj is an individual code symbol that is equal to +1 or –1. The adjacent symbols are assumed to be 0.
The output code is in a bipolar format with 0 and 1 mapped to 1 and –1. The maximum known Barker code length is 13. The short length and low correlation sidelobes make Barker codes useful for frame synchronization in digital communications systems. The Barker code generator outputs the Barker codes listed in this table.
Barker Code Length | Barker Code | Sidelobe Level |
---|---|---|
1
| [–1] | 0 dB |
2
| [–1; 1] | –6 dB |
3
| [–1; –1; 1] | –9.5 dB |
4
| [–1; –1; 1; –1] | –12 dB |
5
| [–1; –1; –1; 1; –1] | –14 dB |
7
| [–1; –1; –1; 1; 1; –1; 1] | –16.9 dB |
11
| [–1; –1; –1; 1; 1; 1; –1; 1; 1; –1; 1] | –20.8 dB |
13
| [–1; –1; –1; –1; –1; 1; 1; –1; –1; 1; –1; 1; –1] | –22.3 dB |
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.
Behavior changed in R2020a
Starting in R2020a, Simulink no longer allows you to use the Barker Code Generator block version available before R2015b.
Existing models automatically update to load the Barker Code Generator block version announced in Source blocks output frames of contiguous time samples but do not use the frame attribute in the R2015b Release Notes. For more information on block forwarding, see Forwarding Tables (Simulink).
Does not support integer only code generation.