# legendreseq

Legendre sequence with perfect periodic autocorrelation function

Since R2024a

## Syntax

``S = legendreseq(N)``

## Description

example

````S = legendreseq(N)` generates a length-N Legendre sequence with perfect periodic autocorrelation function (PACF) `S`. Sidelobe levels of a PACF are zero. Legendre sequences are also known as quadratic residue sequences. The input `N` specifies the length of the generated sequence. N % must be an odd prime number. If N is a prime of a form N=4*n-1, where n % is a positive integer, the generated sequence is biphase. That is the % sequence elements take two distinct values. If N is a prime of a form % N=4*n-3, where n is a positive integer, the generated sequence is % three-phase. The third value appears only once in the first element of the sequence.```

## Examples

collapse all

Generate a phase-coded waveform with a perfect periodic autocorrelation function (PACF). The number of chips (N) is 61. The chip width (tau) is 1e-6 and the modulation period is T*tau sec. The sampling frequency (fs) is 10/tau. Plot the periodic ambiguity function to verify that the PACF has a zero sidelobe level.

Use a legendre sequence for the code.

```N = 61; s = legendreseq(N);```

Set the chip width and sampling freqyency.

```tau = 1e-6; T = tau*N; fs = 10/tau;```

Create a custom phase-coded waveform System object™ and generate waveform samples. Set the PRF to be equal to the inverse of the modulation period.

```waveform = phased.PhaseCodedWaveform(SampleRate=fs,Code="Custom", ... CustomCode=s,ChipWidth=tau,PRF=1/T); x = waveform(); ```

Plot the periodic ambiguity function and show that it has zero sidelobe.

`pambgfun(x,fs,1/T,Cut="Doppler")`

## Input Arguments

collapse all

Code sequence length, specified as an odd-valued positive integer.

• If N is a prime of form N=4*n-1, where n is a positive integer, the generated sequence is biphase. The sequence elements take two distinct values.

• If N is a prime of form N=4*n-3, where n is a positive integer, the generated sequence is three-phase. The third value appears only once in the first element of the sequence.

Example: `11`

Data Types: `double`

## Output Arguments

collapse all

Code sequence, returned as a length-N complex-valued vector.

Data Types: `double`
Complex Number Support: Yes

## References

[1] Levanon, N. and E. Mozeson. Radar Signals. Hoboken, NJ: John Wiley & Sons, 2004.

[2] Farnett, Edward C., George H. Stevens, and Merrill Skolnik. "Pulse compression radar." In Radar handbook Second Edition (1990).

[3] Bomer, L., and Markus Antweiler. "Perfect three-level and three-phase sequences and arrays.", IEEE transactions on communications 42, no. 234 (1994): 767-772.

## Version History

Introduced in R2024a