comm.BarkerCode System object

Package: comm

Generate Barker code

Description

The BarkerCode object generates Barker codes to perform synchronization. Barker codes are subsets of PN sequences. They are short codes, with a length at most 13, which have low-correlation sidelobes. A correlation sidelobe is the correlation of a codeword with a time-shifted version of itself.

To synchronize using a Barker code:

  1. Define and set up your Barker code object. See Construction.

  2. Call step to synchronize according to the properties of comm.BarkerCode. The behavior of step is specific to each object in the toolbox.

Construction

H = comm.BarkerCode creates a Barker code generator System object™, H, that generates a Barker code of a specified length.

H = comm.BarkerCode(Name,Value) creates a Barker code generator object, H, with each specified property set to the specified value. You can specify additional name-value pair arguments in any order as (Name1,Value1,...,NameN,ValueN).

Properties

Length

Length of generated code

Specify the length of the Barker code as a numeric, integer scalar in the set {1, 2, 3, 4, 5, 7, 11, 13}. The default is 7. The codes that the object generates for a specified length are listed in the following table:

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]

SamplesPerFrame

Number of output samples per frame

Specify the number of Barker code samples that the step method outputs as a numeric, integer scalar. The default is 1. If you set this property to a value of M, then the step method outputs M samples of a Barker code sequence of length N. N represents the length of the code that you specify in the Length property.

OutputDataType

Data type of output

Specify the output data type as one of double | int8. The default is double.

Methods

cloneCreate Barker code generator object with same property values
getNumInputsNumber of expected inputs to step method
getNumOutputsNumber of outputs from step method
isLockedLocked status for input attributes and nontunable properties
releaseAllow property value and input characteristics changes
resetReset states of Barker code generator object
stepGenerate Barker code

Examples

expand all

Generate 10 samples of a Barker code sequence with length 7

  hBCode = comm.BarkerCode('SamplesPerFrame', 10);
  seq = step(hBCode)
seq =

    -1
    -1
    -1
     1
     1
    -1
     1
    -1
    -1
    -1

Algorithms

This object implements the algorithm, inputs, and outputs described on the Barker Code Generator block reference page. The object properties correspond to the block parameters, except:

  • The block Sample time parameter does not have a corresponding property.

  • The object only implements frame based outputs.

Was this topic helpful?