Spreading Sequence Generator

Generates spreading sequences useful for DSSS and other spread spectrum waveforms.
37 Descargas
Actualizado 5 jun 2023

Ver licencia

These functions provide a fast, simple interface for generating Maximum Length Sequences with favorable autocorrelation properties for spread-spectrum communication waveforms. Sequences are generated through a simulated linear feedback shift register (LFSR) implementation in the 'Fibonacci' configuration (https://en.wikipedia.org/wiki/Linear-feedback_shift_register#Matrix_forms). The returned sequences are provided as a sequence of "1" and "-1" values. This code is intended for researchers and engineers who need to generate a large number of distinct spreading sequences for testing various DSSS or other spread spectrum detection and analysis algorithms (e.g., Monte Carlo simulations over multiple spreading codes/lengths). There are two functions associated with the generator:
  • [seq,poly,seed] = generateRandomSpreadingSequence(length); This function allows the user to input a specified length (which must be an integer of the form 2^m - 1), and receive a randomly selected MLS ('seq') meeting this length. The sequence is chosen uniformly randomly from all possible primitive polynomials and feedback shift register initialization seed values. In addition to the sequence, the chosen polynomial and seed values are provided to the user, in a bit-vector format for reference as well.
  • seq = generateKnownSpreadingSequence(poly,seed); This function allows the user to specify the primitive polynomial and initial seed values for an equivalent linear feedback shift register, then receive the associated MLS as the output 'seq'. This function is called by 'generateRandomSpreadingSequence()' to obtain the sequence after the random polynomial/seed values are established.
There are a few noteworthy limitations to this implementation:
  • The largest MLS that can be randomly generated with this code is 65535 (i.e., 2^16 - 1). This limitation is due to the use of the MATLAB function 'primpoly' that only produces primitive polynomials up to 16th order. There is no strict limit on generating longer sequences with the 'generateKnownSpreadingSequence()' function, assuming you can independently provide a longer primitive polynomial as input.
  • Longer codes require more processing time. Generating codes of length 65535 take ~50 msec on my machine, whereas generating codes of length 1023 take ~5 msec.
  • The function 'generateKnownSpreadingSequence(poly,seed)' does NOT validate that the provided polynomial is primitive, nor does it validate that the input seed is nonzero. Non-primitive polynomials are still accepted and generate sequences, but the sequences will not be maximum length (i.e., they will repeat). Seed values of zero will cause the output to be all "-1" values.
  • The function 'generateRandomSpreadingSequence(length)' makes use of the MATLAB function 'int2bit()' which was only introduced in R2021b. I have included a workaround in the code that uses the now-deprecated 'de2bi()' function instead, which predates R2006a. If you are using a version of MATLAB older than R2021b, you should comment out the line containing 'int2bit()' and uncomment the line containing 'de2bi()' instead.
  • The MATLAB functions 'primpoly()', 'int2bit()', and 'de2bi()' require the Communications Toolbox to be installed. These functions are used within the 'generateRandomSpreadingSequence()' function. The 'generateKnownSpreadingSequence()' function should not require any toolboxes beyond the basic MATLAB installation to work.

Citar como

Sean Kennedy (2025). Spreading Sequence Generator (https://la.mathworks.com/matlabcentral/fileexchange/130634-spreading-sequence-generator), MATLAB Central File Exchange. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2021b
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux
Etiquetas Añadir etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Versión Publicado Notas de la versión
1.0.0