# Autocorrelation: why is the lagging necessary?

I am currently studying for my last exam. I wanted to ask why it is necessary or useful to perform the autocorrelation of a signal with a lagged version of itself Why does it have to be lagged?

• If you don't have any lag, then with only zero lag, all your autocorrelation represents is the power or energy of the signal. Jun 30, 2023 at 17:13
• It is even worse that you think: you need to find the autocorrelation not just for one lag, but every possible lag. That is, the autocorrelation is a function that associates lag values $0, 1, 2, 3, \ldots$ with corresponding numbers called the value of the autocorrelation for that specific lag. Jun 30, 2023 at 18:12
• @robertbristow-johnson why is that bad Jun 30, 2023 at 18:29
• The autocorrelation offers more information than that. The autocorrelation is the same as the cross-correlation of a signal with itself. So it measures the similarity of a portion of the signal with different (lagged) portions of the same signal. This is very useful for estimating the fundamental frequency of a periodic (or quasi-periodic) signalThat has application in audio, music, and speech processing, but I'll bet it has application in other areas as well. Jun 30, 2023 at 19:47
• @robertbristow-johnson i understand that but I don't understand why it is important for the process of the autocorrelation Jun 30, 2023 at 19:52

The autocorrelation function shows the correlation of the signal with a delayed copy of itself. This is useful for many reasons including:

• The Fourier Transform of this function is the Power Spectral Density.

• It indicates how much "memory" is in the signal: if there is correlation with a delayed copy of itself, then subsequent samples have some dependence on previous samples. Therefore the wider the autocorrelation function is, the further in time this memory extends (indicative of something that has been low pass filtered.

• Waveforms that are random or "pseudo-random" will have a desirable auto-correlation property that will have a maximum value only when the lag parameter = 0 (when the waveform is aligned in time with itself), and will be 0 or close to 0 everywhere else. This is a great property to use as a synchronization signal, and is how GPS works.

• Waveforms that have periodic components will have repeated maximum values in the autocorrelation function, and this can be used to detect such periodicity.

Examples

As an example from GPS, below shows the auto-correlation for the "C/A -code" transmitted from satellite SV24, and the cross-correlation of this same signal with the C/A-code transmitted from satellite SV6. Thus each satellite can transmit on the same carrier frequency (1575.42 MHz), and all satellites are synchronized to each other to transmit at the exact same time. With that from the ground receiver we can correlate to each satellite's code and determine using the correlation functions the pseudo-range to each satellite (the relative range between all the codes received). Given the autocorrelation function has the desirable property of only peaking when perfectly aligned, we can accurately determine the ranges and from that triangulate on our position.

For examples of the "memory" consideration, see the two plots below showing a sequence from a random process where each sample is completely independent of the next (which has NO memory) and then the same waveform after being passed through a 51 sample filter (such that each new output is a weighted sum of the current sample and previous 50 samples, which introduces memory):

Zooming in on the waveforms where the actual samples are indicated (the lines are just an artifact of the plot that was chosen that is connecting the dots). Notice how samples generated from an independently and identically distributed (IID) random process are completely independent from one sample to the next, so we have no way of predicting the next sample from the prior samples. In contrast, we can predict with reasonable accuracy what the next sample will be for the filtered waveform given the previous samples.

The comparative autocorrelation functions for both of these cases is given in the plot below:

Demonstrating the relationship between the autocorrelation function and the power spectral density is the plot below, showing the frequency spectrum for both example waveforms used above. We see that the IID waveform is "white" in that it's power spectral density is spread evenly over all frequencies-- this is a property of any waveform where each sample is independent of the next and is very desirable for many applications (this indicates the signal has maximum information content or entropy as one desirable feature). And we also see how the low pass filtered waveform has all of the higher frequency components significantly attenuated. The power spectral density is important to review for waveforms used for wireless communications as we need to be very careful with spectrum management not to transmit above certain levels out of our assigned bandwidths.

How do I know this? I teach courses on DSP and Python related to wireless comm through dsprelated.com and the ieee with new courses running soon! The GPS and correlation examples are covered in detail in the "DSP for Wireless Communications" course.