This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Preamble Detector

Detect preamble in data packet

  • Library:
  • Communications Toolbox / Synchronization

Description

The Preamble Detector block detects the end of preambles in data packets. A preamble is a set of symbols or bits used in packet-based communications systems to indicate the start of a packet. Packets consist of preamble data and user data. The length of the user data portion of the packet can vary during a simulation run.

This icon shows the block with all ports enabled:

Ports

Input

expand all

Input data of symbols or bits, specified as a scalar or column vector. The input data can contain multiple packets. This port is unnamed on the block.

Data Types: single | double | Boolean | int8 | uint8
Complex Number Support: Yes

Output

expand all

Index of the last preamble symbol, returned as a scalar or column vector of the same size and data type as the input data.

  • When the Detections parameter is set to All, Idx outputs the index corresponding to the last element of each detected preamble.

  • When the Detections parameter is set to First, Idx outputs the index corresponding to the last element of the first detected preamble.

This port is unnamed until the DtMt port in enabled.

Detection metric, returned as a scalar or column vector of the same size and data type as the input data packet.

  • If either the preamble or input data is complex, the detection metric is the absolute value of the cross-correlation of the preamble and the input data.

  • If both the preamble and input data are real, the detection metric is the cross-correlation of the preamble and the input data.

Dependencies

To enable this port, set the Input parameter to Symbol, and select the Output detection metric parameter.

Parameters

expand all

Input type, specified as Symbol or Bit.

  • For binary inputs, set this parameter to Bit.

  • For all other inputs, set this parameter to Symbol.

For information on execution speed, see Tips.

Preamble sequence, specified as a column vector.

  • If the Input parameter is set to Bit, the preamble must be binary.

  • If the Input parameter is set to Symbol, the preamble can be any real or complex sequence.

Detection threshold, specified as a nonnegative scalar. When the detection metric is greater than or equal to the threshold, the block detects the preamble and updates Idx.

Tunable: Yes

Dependencies

To enable this parameter, set the Input parameter to Symbol.

Select this parameter to output the detection metric and enable the DtMt output port.

Dependencies

To enable this parameter, set the Input parameter to Symbol.

Detections returned, specified as All or First. Specifying All returns all detected preambles. Specifying First returns only the first detected preamble.

Tunable: Yes

Type of simulation to run, specified as:

  • Code generation –– Simulate the model 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 as long as the model does not change. This option requires additional startup time.

  • Interpreted execution –– Simulate the model using the MATLAB® interpreter. This option shortens startup time. In Interpreted execution mode, you can debug the source code of the block.

For information on execution speed, see Tips.

Block Characteristics

Data Types

double | single | Boolean | base integer

Multidimensional Signals

No

Variable-Size Signals

Yes

Tips

  • For faster execution of the Preamble Detector block, set the Simulate using parameter to:

    • Code generation when the Input parameter is set to Symbol

    • Interpreted execution when the Input parameter is set to Bit

Algorithms

Bit Inputs

When the input data is composed of bits, the preamble detector uses an exact pattern match.

Symbol Inputs

When the input data is composed of symbols, the preamble detector uses a cross-correlation algorithm. A finite impulse response (FIR) filter, in which the coefficients are specified from the preamble, computes the cross-correlation between the input data and the preamble. When a sequence of input samples match the preamble, the filter output reaches its peak. The index of the peak corresponds to the end of the preamble sequence in the input data. See Discrete FIR Filter for further information on the FIR filter algorithm.

The cross-correlation values that are greater than or equal to the specified threshold are reported as peaks.

  • If the detection threshold is too low, the algorithm will detect false peaks, or, in the extreme case, detect as many detected peaks as there are input samples.

  • If the detection threshold is too high, the algorithm will miss detecting peaks, or, in the extreme case, detect no peaks.

Consequently, the selection of the detection threshold is critical.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Introduced in R2016b