Barker Code Generator
Generate bipolar Barker Code
Libraries:
Communications Toolbox
Communications Toolbox /
Comm Sources /
Sequence Generators
Description
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.
Examples
Ports
Output
output — Barker code frame
column vector
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.
Dependencies
Set the data type of the output with the Output data type parameter.
Parameters
Code length — Length of generated code
7
(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].
Sample time — Output sample time
1
(default) | -1 | positive scalar
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 frame — Samples per output frame
1
(default) | positive integer
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 — Output data type
double
(default) | int8
Output data type, specified as double
or
int8
.
Simulate using — Type of simulation to run
Code 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 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 theInterpreted 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 theCode generation
option. In this mode, you can debug the source code of the block.
Block Characteristics
Data Types |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
More About
Barker Codes
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 |
Sample Timing
The time between output updates is equal to the product of the
Samples per frame and Sample time parameter
values. For example, if Sample time and Samples per
frame each equal 1
, the block outputs a sample every
second. If you increase Samples per frame to 10, then the block outputs
a 10-by-1 vector every 10 seconds. This ensures that the equivalent output rate is not
dependent on the Samples per frame parameter.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Does not support integer only code generation.
Version History
Introduced before R2006aR2020a: Existing models automatically update this block to current version
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 Maintain Compatibility of Library Blocks Using Forwarding Tables (Simulink).
See Also
Blocks
Objects
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)