Generate Hadamard code
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:
Define and set up your Hadamard code object. See Construction.
step to generate a Hadamard
according to the properties of
The behavior of
step is specific to each object in
Starting in R2016b, instead of using the
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( 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 (
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
Row index of Hadamard matrix
Specify the row index of the Hadamard matrix as a numeric, integer
scalar value in the range
When you set this property to an integer k,
the output code has exactly k zero crossings, for k =
Number of output samples per frame
Specify the number of Hadamard code samples that the
When you set this property to a value of M,
Data type of output
Specify the output data type as one of
|reset||Reset states of Hadamard code generator object|
|step||Generate Hadamard code|
|Common to All System Objects|
Create System object with same property values
Expected number of inputs to a System object
Expected number of outputs of a System object
Check locked states of a System object (logical)
Allow System object property value changes
Generate 10 samples of a Hadamard code sequence having a length of 128.
hadamard = comm.HadamardCode('Length',128,'SamplesPerFrame',10) seq = hadamard()
hadamard = comm.HadamardCode with properties: Length: 128 Index: 60 SamplesPerFrame: 10 OutputDataType: 'double' seq = 1 1 1 1 -1 -1 -1 -1 -1 -1
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.
Usage notes and limitations:
See System Objects in MATLAB Code Generation (MATLAB Coder).