Auto-correlation & Cross-correlation
How similar is a signal to a delayed copy of itself? How well do two signals align at different time shifts? Correlation answers these questions — and it unlocks GPS, radar, and speech analysis.
Measuring Similarity
Correlation slides one signal past another and measures their overlap at each position. A large value means strong resemblance; zero means no common structure at that lag.
A Signal Looking at Itself
Multiply x[n] by x[n−l] and sum over all n. The result at lag l tells you how much the signal resembles a version delayed by l samples.
What the Peak Tells You
- Rxx[0] = total signal energy — always maximum
- Symmetric: Rxx[l] = Rxx[−l]
- Periodic signal → peaks at lags 0, ±N, ±2N
- Random noise → sharp spike at 0, near-zero elsewhere
Finding the Time Delay
If y[n] is x[n] delayed by d samples, the cross-correlation Rxy[l] peaks at l = d. This is how you find an echo, a reflection, or a satellite signal.
Visualizing Correlation
Drag the delay slider. Watch the correlation peak shift to match the time offset between the two signals.
Correlation via Convolution
Cross-correlation = convolution with the time-reversed signal. So you can use FFT-based convolution to compute any correlation in O(N log N) instead of O(N²).
The Normalized Coefficient
Divide by both signals’ energies to get a scale-free similarity measure always between −1 and +1. Perfect shape match = ±1. No match = 0.
Where It Appears
- GPS — correlates PRN codes to find satellite range
- Radar — pulse compression, target ranging
- Microphone arrays — direction-of-arrival via time delay
- Speech — pitch detection via auto-correlation peaks
- Communications — receiver synchronization & detection
Signal Detection in Noise
Now that you can measure similarity, the next question is: is the signal there at all? We’ll cover hypothesis testing, the Neyman–Pearson criterion, and ROC curves.