# SNR and "Sampling Error"

I have created some Matlab simulations where I do the following:

Generate a delayed sinusoid which begins at time "T". This is a discrete signal I have created with a sampling frequency 1Mhz, to estimate an analog signal.

I then add white noise to this delayed sinusoid to create a noisy signal.

I use the function finddelay to find the delay between these two signals. This delay is what can be thought of as the "temporal error", or the difference in where the digital system thinks the sine wave in the clean signal begins and where it thinks the sine wave in the noisy signal begins. Since I use finddelay, I'm not using a threshold to find the start of these signals, but the correlation between them.

I am trying to investigate the impact of SNR on this "temporal error", so I repeat this process with different SNR values.

Does anyone know anything about this relationship or can point to some papers or resources? My results have been inconclusive so far, and I feel there may be an issue with my approach or understanding of the problem.

If I can provide more information, let me know and I will. Thank you!

• Adding white noise to a signal does not create a delay. Delays in a signal are typically caused by propagation and distortion along the channel. The Wikipedia page on white noise may be useful here. en.m.wikipedia.org/wiki/Additive_white_Gaussian_noise
– Ryan
Aug 31 at 6:14

There is a somewhat more fundamental issue with delay/range estimation in this scenario, of which you haven't made mention, and that is the inherent phase ambiguity when trying to match two continuous-wave sine functions. If you send a waveform out with phase of $$0$$ rad, and get one back with a phase of $$\pi/2$$ rad, was it delayed by 250ns or was it delayed by 1250ns? Technically you could try and match the leading and trailing edges of your continuous-wave pulse, but that's significantly more difficult in the real world because of noise (as you mentioned) and the fact that at pulse boundaries the instantaneous bandwidth grows very large and suffers distortion.

The MATLAB documentation for finddelay() says

The finddelay function uses the xcorr function to determine the cross-correlation between each pair of signals at all possible lags specified by the user. The normalized cross-correlation between each pair of signals is then calculated. The estimated delay is given by the negative of the lag for which the normalized cross-correlation has the largest absolute value.

If more than one lag leads to the largest absolute value of the cross-correlation, such as in the case of periodic signals, the delay is chosen as the negative of the smallest (in absolute value) of such lags.

As far as what the relationship is between the delay estimate from above and SNR is, we can look at the two extreme cases and come to some basic conclusions.

The first is the ideal case where there is no noise and the signals are absolute duplicates with some delay between them. The magnitude of the auto-correlation function with respect to lag time will be a triangular function with a distinct peak. This is what we expect as the overlap increases between the functions. You should always get the same result because nothing could change this deterministic outcome.

The second is the anti-ideal case where the SNR is 0. An Independently, Identically-Distributed random variable, is by definition expected to be uncorrelated with any signal, because independence implies uncorrelated. What this means is that we expect over the course of multiple trials, the magnitude of the cross-correlation function between a Gaussian random variable and sine function should average out to a constant versus lag time. In fact, this constant should be proportional to the Power Spectral Density of both signals if my memory is correct. However, for any individual measurement, the peak could be anywhere from sample 1 to N.

So for significantly long signals (I put this caveat because the flat distribution of the second case would make the nature of this very asymmetrical), we could model this behavior by saying the expected value $$E[\hat{\tau}]=\tau$$ where $$\tau$$ is the true lag time. However, the variance between experiments $$E[(\hat{\tau}-\tau)^2]$$ is... unlikely to be a simple algebraic function considering we're discussing the expected value of the location of a peak in a correlation function partial-blend of a random variable and a signal, but I think given the two extremes we can say with confidence it's always going to be inversely related to the SNR.

For resources, you may want to find books on pulsed or continuous wave radar. Unfortunately most literature will refer to pulse-doppler, pulse-compression, or other more advanced radar techniques because of exactly these drawbacks. Pulsed waves without any doppler filtering are extremely susceptible to clutter, range ambiguity, and interference. I suggest if you are trying to find a solution that avoids these issues you consider something based on LFM (just mind the range-doppler coupling) or pulse-coding (barker codes are extremely useful).