comm.HadamardCode System object

Package: comm

Generate Hadamard code

Description

The HadamardCode object generates a Hadamard code from a Hadamard matrix, whose rows form an orthogonal set of codes. You can use orthogonal codes for spreading in communication systems in which the receiver is perfectly synchronized with the transmitter. In these systems, the despreading operation is ideal, because the codes decorrelate completely.

To generate a Hadamard code:

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

  2. Call step to generate a Hadamard according to the properties of comm.HadamardCode. The behavior of step is specific to each object in the toolbox.

Construction

H = comm.HadamardCode creates a Hadamard code generator System object™, H. This object generates Hadamard codes from a set of orthogonal codes.

H = comm.HadamardCode(Name,Value) creates a Hadamard 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 generated code as a numeric, integer scalar value with a power of two. The default is 64.

Index

Row index of Hadamard matrix

Specify the row index of the Hadamard matrix as a numeric, integer scalar value in the range [0, 1, ... , N-1]. N is the value of the Length property. The default is 60. An N×N Hadamard matrix, denoted as P(N), is defined recursively as follows: P(1) = [1] P(2N) = [P(N) P(N); P(N) –P(N)] The NxN Hadamard matrix has the property that P(N)×P(N)' = N×eye(N). The step method outputs code samples from the row of the Hadamard matrix that you specify in this property.

When you set this property to an integer k, the output code has exactly k zero crossings, for k = 0, 1, ... , N1.

SamplesPerFrame

Number of output samples per frame

Specify the number of Hadamard code samples that the step method outputs as a numeric, positive, integer scalar value. The default is 1.

When you set this property to a value of M, the step method outputs M samples of a Hadamard code of length N. N equals 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 Hadamard 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 Hadamard code generator object
stepGenerate Hadamard code

Examples

Generate 10 samples of a Hadamard code sequence with a length of 64.

    hHCode = comm.HadamardCode('SamplesPerFrame', 10);
    seq = step(hHCode)

Algorithms

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

  • The object does not have a property to select frame based outputs.

  • The object does not have a property that corresponds to the Sample time parameter.

Was this topic helpful?