Main Content

comm.HadamardCode

Generate Hadamard code

Description

The comm.HadamardCode System object™ generates a code sequence from a Hadamard matrix, whose rows form an orthogonal set of codes. When the receiver is synchronized with the transmitter, use orthogonal codes for spreading signals in communication systems. In this case, the ideal despreading operation results in complete decorrelation of the codes. For more information, see Algorithms.

To generate a Hadamard codes:

  1. Create the comm.HadamardCode object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

Creation

Description

hadamard = comm.HadamardCode creates a System object that generates a Hadamard code.

example

hadamard = comm.HadamardCode(Name=Value) creates a Hadamard code generator object with each specified property set to the specified value. For example, comm.HadamardCode(Length="128",SamplesPerFrame="10") outputs the first ten samples of a length 128 Hadamard code generator.

Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects.

Length of the generated code, specified as a nonnegative integer, power of 2.

The row index of the Hadamard code matrix, specified as a positive integer in the range [0, N – 1]. N is the value of the Length property. Hadamard codes are defined as the rows of an N-by-N matrix, PN. The value of this property specifies the row of the PN matrix as the code of interest. For more information, see Recovering and Reconstructing Hadamard Codes.

Number of Hadamard code samples output, specified as a positive integer. Each time the object runs, it outputs the first SamplesPerFrame values of the Hadamard code specified by the Length and Index property values. The Hadamard code sequence repeats to fill the specified number of samples.

Output data type, specified as one of 'double' or 'int8'.

Usage

Description

example

Y = hadamard() outputs a frame of the Hadamard code in a column vector.

Output Arguments

expand all

Frame of Hadamard code samples, returned as a column vector. The output is code in a bipolar format with 0 and 1 mapped to 1 and -1, respectively. Specify the data type to output with the OutputDataType property.

Data Types: double | int8

Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named obj, use this syntax:

release(obj)

expand all

stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object

Examples

collapse all

Generate 10 samples of a Hadamard code sequence that has a length of 128.

hadamard = comm.HadamardCode(Length=128,SamplesPerFrame=10)
hadamard = 
  comm.HadamardCode with properties:

             Length: 128
              Index: 60
    SamplesPerFrame: 10
     OutputDataType: 'double'

seq = hadamard()
seq = 10×1

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

Algorithms

expand all

Extended Capabilities

Version History

Introduced in R2012a