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:
Starting in R2016b, instead of using the
to perform the operation defined by the System object™, you can
call the object with arguments, as if it were a function. For example,
= step(obj) and
y = obj() perform equivalent
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, the
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|
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)
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
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).