CORRELATION
SIGNAL CORRELATION

When two signals tend to point in the same direction, we say that they are correlated. Signals show a positive correlation if they tend to increase and decrease together. Signals show a negative correlation if one tends to increase when the other decreases, and vice-versa. Signals are decorrelated if there is no discernible relationship between them. Below is an example of two positively correlated signals. The energy produced by a wind turbine is positively correlated with the average wind speed in the region. As the wind speed increases, the turbine produces more energy. As the wind speed decreases, the turbine will produce less energy.

 Figure 1.  Example of Signals with Positive Correlation Blue: Wind Speed Red: Electrical Output of Turbine

The dot product allows us to measure the amount of correlation between two signals. In the previous section we saw how the dot product allows us to measure the degree to which two 2-D vectors are pointing in the same direction, but it can be hard to mentally extrapolate this concept of directionality to signals with many values (more than two dimensions). Let’s return to sine waves, as they are easier to reason about mathematically, and provide us with a clear visualization of the dot product as applied to signals.

THE DOT PRODUCT
RELATIONSHIP TO CORRELATION

Figure 2 visualizes the dot product of two signals which we’ll call A and B. Signal A and signal B are both sine waves. A is the topmost waveform in the visualization, and B lies directly beneath it. You can use the slider at the bottom of the figure to shift the phase of signal A. Below the two sine waves you’ll find another signal which corresponds to the product of the two sines - the result of multiplying A by B. The area under this curve is shaded, as it represents the sum of the products.1 The sum of the products is the dot product. The final value of the dot product is plotted on a number line at the very bottom of the figure.

 Figure 2.  Computing the Dot Product of Two Sines. Phase Shift

As you adjust the phase of signal A, notice that the dot product gives a good indication of the correlation between signal A and B. When the two sine waves are perfectly in-sync, their dot product is at a maximum which indicates a positive correlation. When the two waves are 180 degrees out of phase, they have a very large but negative dot product, indicating that they are negatively correlated. you’ll notice something interesting when A and B are 90 degrees out of phase. In this configuration, A turns into a cosine wave, and the dot product of A and B assumes a value of zero. This is an important find, and you should keep the following fact in mind: a sine and cosine wave at the same frequency are actually decorrelated.2

Now that we have an intuition for interpretation of the dot product in relation to signals, we'll move on to calculating correlations between sine waves and more complex waveforms.

1. So, here I'm being a bit sloppy. The shaded area corresponds to something like the dot product of two continuous signals. However, I find it really helpful to visualize the area, so you can visually balance the bits that are above and below the x-axis.

2. Another interesting tidbit: The product of a sine and cosine wave at equal frequencies is a sine wave with double the frequency.

In the future, I'd like to write up a section on autocorrelation. For the time being, you should note that Figure 2 is also a visualization of the process of autocorrelation. Autocorrelation can be used to create interesting things like a simple monophonic pitch-detector. Interestingly, you can efficiently compute the autocorrelation of a signal using the FFT.