## Wednesday, May 22, 2019

### Random Autocorrelation Sequences MATLAB version

Autocorrelation sequences (ACSs) are commonly used in a variety of fields. When testing an algorithm or conduction simulations it is sometimes useful to use a random ACS. Generating random a random ACS can be difficult because they have a lot of special properties and if you select a sequence at random, the chance it is a valid ACS is small.

We can use the following property of ACSs to make generating random ACSs easy. The ACS and the power spectral density (PSD) are Fourier transform (FT) pairs. For our purpose here, a PSD is just a function that is positive everywhere. "FT pair" means the FT of an ACS is a PSD and the invers FT of a PSD is an ACS.

So we can generate a random ACS using the following steps. First, generate a random sequence. Second, square each element. Finally, find the inverse FT of the squared sequence.

The matlab code below does just that.
N = 9;
PSD = randn(1,N).^2;
ACS = ifft(PSD);
ACS
ACS =
1.0022 + 0.0000i  -0.0828 + 0.1658i   0.1847 - 0.0446i   0.0978 + 0.1778i   0.3034 - 0.3709i   0.3034 + 0.3709i   0.0978 - 0.1778i   0.1847 + 0.0446i  -0.0828 - 0.1658i