Maths Formulae Transforms Correlation

Correlation – Signal Comparison and Similarity

Explore the use of correlation to compare signals, identify similarities, and detect patterns in frequency and time.
🔑

Definition of Correlation

Correlation measures the similarity between two signals as a function of time delay (lag), revealing how much one signal resembles another when shifted in time. It's the mathematical detective tool that finds patterns, matches templates, and identifies relationships between signals. Unlike convolution which blends signals together, correlation compares them to find similarities - like finding your voice in a noisy room or detecting a specific pattern in data streams.

SymbolDescription
\[ f(t) \]Reference Signal - First signal or template for comparison
\[ g(t) \]Test Signal - Second signal being compared against reference
\[ R_{fg}(\tau) \]Cross-correlation - Similarity measure between f and g at lag τ
\[ R_{ff}(\tau) \]Auto-correlation - Signal's similarity with itself at different lags
\[ \tau \]Time Lag/Shift - Delay parameter showing optimal alignment
\[ * \]Complex Conjugate - Ensures proper phase relationships
\[ \star \]Correlation Operator - Mathematical symbol for correlation operation
📐

Key Formulas

\[ R_{fg}(\tau) = \int_{-\infty}^{\infty} f(t) g^*(t + \tau) dt = \int_{-\infty}^{\infty} f(t - \tau) g^*(t) dt \]
General Correlation Integral
\[ R_{ff}(\tau) = \int_{-\infty}^{\infty} f(t) f^*(t + \tau) dt \]
Auto-correlation Integral
\[ R_{fg}[m] = \sum_{n=-\infty}^{\infty} f[n] g^*[n + m] \]
Discrete Correlation
\[ R_{fg}(\tau) = f(\tau) \star g(\tau) \]
Cross-correlation Operator
\[ f^*(x) \star f(x) \iff |F(s)|^2 \]
Auto-correlation in Frequency Domain (Wiener-Khinchin Theorem)
\[ \int_{-\infty}^{\infty} f(x)g^*(x)dx = \int_{-\infty}^{\infty} F(s)G^*(s)ds \]
Parseval's Theorem for Correlation
🖼️

Conceptual Diagram

f(t) g(t) lag τ R(τ) peak at τ R(τ) = ∫ f*(t) g(t+τ) dt
Cross-Correlation R(τ): measures similarity between f(t) and shifted g(t) — peak reveals best alignment lag

Correlation involves two signals, a reference signal f(t) and a test signal g(t). The process is visualized as sliding one signal, g(t), across the other along the time axis. The amount of the slide is the lag, denoted by τ. At each lag position, the overlapping portions of the signals are multiplied together point-by-point, and the products are summed (or integrated). The result is a single value representing the similarity at that specific lag. Plotting this similarity value for all possible lags produces the correlation function R_fg(τ).

Properties of Correlation

Symmetry Property: The cross-correlation function exhibits conjugate symmetry, meaning `R_fg(τ) = R*_gf(-τ)`. This shows how the order of the functions and the direction of the time shift are related.

Maximum at Zero Lag (for Auto-correlation): For most real-world signals (energy signals), the auto-correlation function `R_ff(τ)` has its maximum value at `τ = 0`, as this is the point where the signal perfectly aligns with itself.

Convolution Relationship: Correlation is equivalent to convolution with one of the signals time-reversed. Specifically, `R_fg(τ) = f(τ) * g*(-τ)`, where `*` denotes convolution.

Correlation in the Fourier Domain: The Fourier transform of the cross-correlation of two signals is equal to the product of the Fourier transform of the first signal and the complex conjugate of the Fourier transform of the second signal. `F{R_fg(τ)} = F(ω)G*(ω)`.

✍️

Proof of the Correlation Theorem

We aim to prove that the Fourier transform of a correlation is the product of the individual Fourier transforms, with one being conjugated: `F{f(t) ★ g(t)} = F*(ω)G(ω)`. We will use the relationship between correlation and convolution.

Step 1: Express correlation in terms of convolution. The correlation operation `R_fg(t) = f(t) ★ g(t)` can be written as convolution with a time-reversed and conjugated function.

\[ R_{fg}(t) = f(t) \star g(t) = \int_{-\infty}^{\infty} f(\tau) g^*(t+\tau) d\tau = f(t) * g^*(-t) \]
Correlation as Convolution

Step 2: Take the Fourier Transform of both sides of the equation.

\[ \mathcal{F}\{ R_{fg}(t) \} = \mathcal{F}\{ f(t) * g^*(-t) \} \]
Applying Fourier Transform

Step 3: Apply the convolution theorem, which states that the Fourier transform of a convolution is the product of the individual Fourier transforms: `F{a(t) * b(t)} = A(ω)B(ω)`.

\[ \mathcal{F}\{ R_{fg}(t) \} = \mathcal{F}\{f(t)\} \cdot \mathcal{F}\{g^*(-t)\} = F(\omega) \cdot \mathcal{F}\{g^*(-t)\} \]
Applying Convolution Theorem

Step 4: Use the time-reversal and conjugation properties of the Fourier Transform. The property states that `F{h^*(-t)} = H*(ω)`. Applying this to `g(t)` gives `F{g^*(-t)} = G*(ω)`.

\[ \mathcal{F}\{ R_{fg}(t) \} = F(\omega) G^*(\omega) \]
Final Result

This completes the proof, showing that correlation in the time domain corresponds to conjugate multiplication in the frequency domain.

💡

Worked Example

Given two finite discrete signals, `f[n] = {2, 1, 0}` for `n = 0, 1, 2` and `g[n] = {1, 1, 3}` for `n = 0, 1, 2`. Calculate the discrete cross-correlation `R_fg[m] = Σ f[n]g[n-m]`.
  1. Write the formula: `R_fg[m] = Σ f[n]g[n-m]`. We will slide `g` relative to `f`.
  2. Calculate for `m = 0`: `R_fg[0] = f[0]g[0] + f[1]g[1] + f[2]g[2] = (2)(1) + (1)(1) + (0)(3) = 2 + 1 + 0 = 3`.
  3. Calculate for `m = 1`: `g` is shifted right by 1. `R_fg[1] = f[1]g[0] + f[2]g[1] = (1)(1) + (0)(1) = 1`.
  4. Calculate for `m = 2`: `g` is shifted right by 2. `R_fg[2] = f[2]g[0] = (0)(1) = 0`.
  5. Calculate for `m = -1`: `g` is shifted left by 1. `R_fg[-1] = f[0]g[1] + f[1]g[2] = (2)(1) + (1)(3) = 2 + 3 = 5`.
  6. Calculate for `m = -2`: `g` is shifted left by 2. `R_fg[-2] = f[0]g[2] = (2)(3) = 6`.
  7. For other values of `m`, there is no overlap, so the result is 0.
The cross-correlation sequence `R_fg[m]` is `{..., 0, 6, 5, 3, 1, 0, ...}` with the peak at `m = -2`.
🚀

Applications

📡 Radar & Sonar Systems: Correlation is used for target detection and range finding. A known pulse is transmitted, and the received signal is correlated with the original pulse. The time lag of the correlation peak determines the distance to the object.

🔍 Pattern Recognition & Computer Vision: In a process called template matching, correlation is used to find a small template image within a larger image. The location of the highest correlation value indicates the best match, used for object detection, face recognition, and motion tracking.

📈 Finance & Economics: Economists use correlation to analyze the relationship between different financial time series, such as stock prices or interest rates. This helps in portfolio diversification and risk assessment by understanding how different assets move in relation to each other.

🧬 Medical & Biological Sciences: Correlation is used to analyze biomedical signals like ECG (electrocardiogram) and EEG (electroencephalogram). It helps in detecting anomalies, identifying patterns related to certain conditions, and studying the functional connectivity between different brain regions.

🌍

Real-World Examples

A radar system sends a signal which reflects off an aircraft and returns. The time delay between sending the signal and receiving the echo is found by cross-correlation to be 200 microseconds (200 x 10⁻⁶ s). If the signal travels at the speed of light (3 x 10⁸ m/s), how far away is the aircraft?
  1. The total time for the signal to travel to the aircraft and back is `t = 200 μs`.
  2. The distance to the aircraft is based on a one-way trip, so the time for one way is `t_one_way = t / 2 = 100 μs = 100 x 10⁻⁶ s`.
  3. The distance is calculated using the formula: `Distance = Speed × Time`.
  4. Substitute the values: `Distance = (3 x 10⁸ m/s) × (100 x 10⁻⁶ s)`.
  5. Calculate the result: `Distance = 3 x 10⁴ m = 30,000 m`.
The aircraft is 30 kilometers away from the radar system.
An audio engineer records a concert with two microphones placed 3.43 meters apart. A sharp sound (like a cymbal crash) arrives at the second microphone 10 milliseconds (0.01 s) after the first. What is the speed of sound in the concert hall?
  1. The time delay `τ` is found by finding the peak of the cross-correlation of the two microphone signals, which is given as `τ = 0.01 s`.
  2. The distance between the microphones is `d = 3.43 m`.
  3. The speed of sound `v` can be calculated using the formula `Speed = Distance / Time`.
  4. Substitute the values: `v = 3.43 m / 0.01 s`.
  5. Calculate the result.
The speed of sound in the concert hall is 343 m/s.
🏞️

Real-World Scenarios

TX target RX delay = 2R/c correlation finds τ → R
Radar Range Finding
Radar systems cross-correlate the transmitted pulse with the received echo to find time delay τ. The range to target R = cτ/2. Correlation pinpoints the peak with precision even in noisy environments.
correlate PRN codes
GPS Positioning
GPS receivers cross-correlate received satellite signals with locally generated PRN codes to measure travel time with nanosecond accuracy — enabling metre-level positioning globally.
R(τ)↑ match! correlation matching
Biometric Fingerprint ID
Fingerprint recognition computes cross-correlation between scanned and stored patterns. A high correlation peak at zero lag confirms a match — used in smartphones, passports, and secure access systems.

GPS Navigation: GPS receivers in your phone or car continuously correlate incoming signals from multiple satellites with a known pseudo-random code. The time shift that produces the highest correlation peak for each satellite's signal reveals the signal's travel time. By calculating the distance to at least four satellites, the receiver can triangulate its precise location on Earth.

Noise-Cancelling Headphones: These headphones have microphones that listen to ambient noise. The electronics inside create an 'anti-noise' signal that is the exact inverse of the incoming noise. To do this accurately, they use correlation techniques to constantly match and predict the pattern of the external sound waves, allowing them to be cancelled out before they reach your ear.

Streaming Video Services: When you stream a movie, services like Netflix or YouTube use correlation to measure network quality. They send small, known data packets and correlate them with the packets received to measure time delay (latency) and data loss. This helps them adjust the video quality in real-time to ensure smooth playback without buffering.

📚

Types and Classifications

TypeDescriptionTypical Use Case
Cross-correlationMeasures the similarity between two *different* signals (f and g) as a function of the time lag applied to one of them.Finding a known signal in a noisy measurement (e.g., radar echo detection).
Auto-correlationMeasures the similarity between a signal and a time-shifted version of *itself*. It shows how a signal's structure repeats over time.Detecting periodicity or the fundamental frequency in a signal (e.g., pitch detection in an audio recording).
Normalized Cross-correlationA version of cross-correlation where the result is scaled to be between -1 and +1. This makes the measurement independent of signal amplitude and brightness.Template matching in images where lighting conditions can vary, ensuring the match is based on pattern, not intensity.
⚠️

Common Mistakes

⚠️ Confusing Correlation with Convolution: This is the most common error. Correlation compares signals using `g(t + τ)` (no time reversal), while convolution models a system's output using `g(τ - t)` (involving time reversal). A simple mnemonic is: 'Correlation Compares, Convolution Combines'.
💡 Misinterpreting the Correlation Peak: The peak of the correlation function provides two pieces of information. Its *location* on the time-lag axis (τ) tells you the optimal shift for alignment. Its *height* (amplitude) tells you the degree of similarity at that alignment. Students often forget to analyze both aspects.
💡 Ignoring Normalization: When comparing signals or images with different energy levels or brightness, standard correlation can be misleading. A bright but poorly matching region can yield a higher correlation score than a dim but perfectly matching one. Use normalized cross-correlation to ensure the comparison is based purely on the pattern, not the intensity.
🚀

Study Strategy

1 🧠 Grasp the Fundamentals
  • Review the 'Definition of Correlation' to understand it as a measure of similarity between two signals as a function of the displacement of one relative to the other.
  • Study the 'Conceptual Diagram' to visualize how sliding one signal past another and integrating the product reveals areas of high similarity.
  • Internalize the 'Properties of Correlation,' such as the Cauchy-Schwarz inequality and the property that autocorrelation is maximum at zero lag.
  • Distinguish clearly between autocorrelation (a signal correlated with itself) and cross-correlation (correlation between two different signals).
2 ✍️ Commit Formulas to Memory
  • Write out the integral formula for continuous-time cross-correlation until you can do it from memory.
  • Practice writing the summation formula for discrete-time cross-correlation, paying close attention to the indices.
  • Memorize the 'Correlation Theorem,' which states that correlation in the time domain corresponds to complex conjugate multiplication in the frequency domain.
  • Learn the specific formula for calculating signal energy from the autocorrelation function at zero lag (Rxx(0)).
3 ✏️ Solve Guided Problems
  • Follow the 'Worked Example' step-by-step, recalculating each integral or sum yourself to ensure you understand the process.
  • Apply the formula to simple functions, such as correlating two rectangular pulses or a triangular pulse with itself.
  • Use the 'Proof of the Correlation Theorem' as a guide to solve a problem in the frequency domain and verify the result.
  • Review the 'Common Mistakes' section and attempt problems where those mistakes are likely, such as incorrect integration limits or handling of complex conjugates.
4 📡 Connect to Real-World Applications
  • Choose an application from the 'Applications' list, such as radar signal processing, and explain how a correlation peak is used to determine target distance.
  • Analyze a 'Real-World Scenario,' like pattern recognition in image processing, and describe how cross-correlation helps locate a template within a larger image.
  • Interpret the physical meaning of the lag (τ or n) in a practical context, like identifying the time delay between signals received by two different microphones.
  • Explain how correlation is used in communications to detect a known signal in the presence of noise, as highlighted in 'Real-World Examples'.
By systematically building from core concepts to practical applications, you can master the correlation formula and its power in signal analysis.

Frequently Asked Questions

×

×