Documentation Center

  • Trial Software
  • Product Updates

Hadamard Code Generator

Generate Hadamard code from orthogonal set of codes


Sequence Generators sublibrary of Comm Sources


The Hadamard Code Generator block generates a Hadamard code from a Hadamard matrix, whose rows form an orthogonal set of codes. Orthogonal codes can be used for spreading in communication systems in which the receiver is perfectly synchronized with the transmitter. In these systems, the despreading operation is ideal, as the codes are decorrelated completely.

The Hadamard codes are the individual rows of a Hadamard matrix. Hadamard matrices are square matrices whose entries are +1 or -1, and whose rows and columns are mutually orthogonal. If N is a nonnegative power of 2, the N-by-N Hadamard matrix, denoted HN, is defined recursively as follows.

The N-by-N Hadamard matrix has the property that


where IN is the N-by-N identity matrix.

The Hadamard Code Generator block outputs a row of HN. The output is bipolar. You specify the length of the code, N, by the Code length parameter. The Code length must be a power of 2. You specify the index of the row of the Hadamard matrix, which is an integer in the range [0, 1, ... , N-1], by the Code index parameter.

Dialog Box

Code length

A positive integer that is a power of two specifying the length of the Hadamard code.

Code index

An integer between 0 and N-1, where N is the Code length, specifying a row of the Hadamard matrix.

Sample time

A positive real scalar specifying the sample time of the output signal.

Frame-based outputs

Determines whether the output is frame-based or sample-based.

Samples per frame

The number of samples in a frame-based output signal. This field is active only if you select Frame-based outputs.

Output data type

The output type of the block can be specified as an int8 or double. By default, the block sets this to double.

Was this topic helpful?