Walsh Code Generator
Generate Walsh code from orthogonal set of codes
Sequence Generators sublibrary of Comm Sources
Walsh codes are defined as a set of N codes, denoted Wj, for j = 0, 1, ... , N - 1, which have the following properties:
Wj takes on the values +1 and -1.
Wj = 1 for all j.
Wj has exactly j zero crossings, for j = 0, 1, ... , N - 1.
Each code Wj is either even or odd with respect to its midpoint.
Walsh codes are defined using a Hadamard matrix of order N. The Walsh Code Generator block outputs a row of the Hadamard matrix specified by the Walsh code index, which must be an integer in the range [0, ..., N - 1]. If you set Walsh code index equal to an integer j, the output code has exactly j zero crossings, for j = 0, 1, ... , N - 1.
Note, however, that the indexing in the Walsh Code Generator block is different than the indexing in the Hadamard Code Generator block. If you set the Walsh code index in the Walsh Code Generator block and the Code index parameter in the Hadamard Code Generator block, the two blocks output different codes.
- Code length
Integer scalar that is a power of 2 specifying the length of the output code.
- Code index
Integer scalar in the range [0, 1, ... , N - 1], where N is the Code length, specifying the number of zero crossings in the output code.
- Sample time
Positive scalars specify the time in seconds between each sample of the output signal. If you set the Sample time to
-1, the output signal inherits the sample time from downstream. For information on the relationship between the Sample time and Samples per frame parameters, see Sample Timing.
- Samples per frame
Samples per frame, specified as a positive integer indicating the number of samples per frame in one channel of the output data. If Samples per frame is greater than the Code length, the code is cyclically repeated. For information on the relationship between Sample time and Samples per frame, see Sample Timing.
- Output data type
The output type of the block can be specified as an
double. By default, the block sets this to
The time between output updates is equal to the product of the
Samples per frame and Sample time parameter
values. For example, if Sample time and Samples per
frame each equal
1, the block outputs a sample every
second. If you increase Samples per frame to 10, then the block outputs
a 10-by-1 vector every 10 seconds. This ensures that the equivalent output rate is not
dependent on the Samples per frame parameter.
Existing models automatically update this block to current version
Behavior changed in R2020a
Starting in R2020a, Simulink® no longer allows you to use the Walsh Code Generator block version available before R2015b.
Existing models automatically update to load the Walsh Code Generator block version announced in Source blocks output frames of contiguous time samples but do not use the frame attribute in the R2015b Release Notes. For more information on block forwarding, see Maintain Compatibility of Library Blocks Using Forwarding Tables (Simulink).
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Does not support integer only code generation.