Cross-Correlation and Time Delay Estimator
Turn a cross-correlation peak lag into a time delay and distance, for one-way TDOA ranging or round-trip radar and sonar echoes.
📶 What is Cross-Correlation Time Delay Estimation?
Cross-correlation time delay estimation finds how long it took a signal to travel from a source to a receiver (or from a transmitter to a reflecting target and back) by sliding one signal against another and finding the time shift that makes them line up best. That best-matching shift, the peak of the cross-correlation function, is the estimated time delay, which converts directly into a distance once you know how fast the signal travels.
Radar and sonar systems use round-trip time delay estimation as their fundamental ranging mechanism, sending a pulse and cross-correlating the returning echo against the original transmitted waveform to find the target's range. Acoustic source localization systems use one-way (or relative) time delay estimation between multiple microphones to triangulate where a sound came from. GPS and other radio-based positioning systems rely on precisely the same cross-correlation principle, comparing a received signal against a locally generated reference to find the time-of-flight from each satellite.
A common source of confusion is mixing up one-way and round-trip delay. They use the exact same underlying cross-correlation math, but round-trip systems (radar, sonar, ultrasonic rangefinders) must divide the measured delay by 2 before converting to distance, since the signal covers the same physical distance twice, once outbound and once as the returning echo.
This calculator takes a correlation peak lag you have already found (in samples), converts it into a time delay, and reports the corresponding distance for either measurement mode, along with the theoretical resolution limit set by your pulse's duration.
📐 Formula
📖 How to Use This Calculator
Steps
💡 Example Calculations
Example 1 — Microphone Array TDOA (One-Way)
One-way, lag = 100 samples, fs = 44,100 Hz, v = 343 m/s (sound in air), Tp = 5 ms
Example 2 — Radar Echo Ranging (Round-Trip)
Round-trip, lag = 50 samples, fs = 1,000,000 Hz, v = 3×108 m/s (radio), Tp = 0.001 ms
Example 3 — Underwater Sonar Ranging (One-Way)
One-way, lag = 2,000 samples, fs = 192,000 Hz, v = 1,500 m/s (sound in water), Tp = 2 ms
❓ Frequently Asked Questions
🔗 Related Calculators
What is cross-correlation used for in time delay estimation?
Cross-correlation slides a copy of a known reference signal across a received signal and measures how well they match at each possible time shift. The shift (lag) that produces the highest correlation value is the estimated time delay between when the signal left its source and when it was received.
How do you convert a correlation peak lag into a time delay?
Divide the peak lag, measured in samples, by the sampling rate: tau = lag / fs. This gives the time delay in seconds (or milliseconds after scaling), the core measurement every cross-correlation-based ranging system produces.
What is the difference between one-way and round-trip delay estimation?
One-way estimation applies when a signal travels directly from a source to a separate receiver (TDOA microphone arrays, GPS-style beacons), so distance equals speed times delay. Round-trip estimation applies to radar and sonar, where a single device sends a pulse and receives its own reflected echo, so the wave covers the distance twice and the delay must be halved before converting to distance.
Why does radar and sonar divide the delay by 2?
In radar and sonar, the transmitted pulse travels from the device to the target and the echo travels back, covering the same one-way distance twice for a single round-trip delay measurement. Dividing the measured round-trip time by 2 before multiplying by propagation speed recovers the true one-way distance to the target.
What sets the resolution of a cross-correlation-based range measurement?
For two identical rectangular pulses, the cross-correlation forms a triangular peak with base width equal to twice the pulse duration. A shorter pulse produces a narrower, sharper peak, which lets the delay (and therefore the distance) be pinpointed more precisely, the same trade-off pulse compression radar techniques are designed around.
What propagation speed should I use?
Use the actual speed of the wave in its medium: about 343 m/s for sound in air at room temperature, roughly 1,480 to 1,500 m/s for sound in water depending on temperature and salinity, and the speed of light, 299,792,458 m/s, for radio, radar, and lidar signals.
Can this calculator estimate delay directly from raw signal data?
No, this calculator takes the already-found peak lag (in samples) as an input, the output of a cross-correlation computation you have already performed, rather than computing the cross-correlation of raw signal data itself. It converts that lag into a time delay and distance.
How is this different from the Autocorrelation Function Calculator?
The Autocorrelation Function Calculator compares one signal against a lagged copy of itself, useful for periodicity and pitch detection. This calculator is built around cross-correlation between two related but distinct signals (a transmitted pulse and its received echo, or the same source arriving at two sensors), the standard tool for time delay and ranging.
Does a longer measured delay always mean a farther target?
Yes, for a fixed propagation speed and measurement mode, delay and distance are directly proportional. But be careful to use the correct mode: a round-trip delay corresponds to half as much distance as the same numerical delay would in one-way mode, since it represents travel in both directions.
What is a typical use case for one-way TDOA delay estimation?
Multi-microphone sound source localization is a classic example: cross-correlating the same sound as captured by two spatially separated microphones gives the small time-of-arrival difference between them, which, combined with the microphone spacing and sound speed, is used to estimate the direction the sound came from.