Hi guys, I have to determine the time lag between two signals x and y for an acoustic distance measurement setup. The signal x is the test input signal and y is the reflected signal from the acoustic path. This is modeled the following: y = h * y + N whereas N is additional gaussian noise and h is the impulse response of the acoustic path. (The operator * states for a convolution operator). My first approach for determining the time delay was correlation based. Doing a cross-correlation (CC) between the two signals x and y and take the maximum of the absolute of it. Here is a little Matlab example of this trivial approach: [Rxy, k] = xcorr(y, x); [~, loc] = max(abs(Rxy)); lag = k(loc); The performance of this was not that good since there is a distortion through the acoustic path and noise. I looked up this problem a bit on the internet and found the generalized cross correlation (GCC) which introduces a weighting function in the frequency domain. I tried these approaches but did not get any meaningful results respectively an improvement to a simple CC as described above. Consider for example the following snipped with a PHAT weighting function: N = max(length(x), length(y)); X = fft(x, N); Y = fft(y, N); Gxy = conj(Y) .* X; Gxy = Gxy ./ abs(Gxy); Rxy = fftshift(real(ifft(Gxy))); This does not yield a meaningful result. There is no correlation visible when plotting this. Also other weighting functions (ROTH, HT, SCOT) do not really show an expected result. Can anyone help and give me some advice why there is no improvement using GCC or what I'm doing wrong with it? Thank you in advance! Cheers Robert
CC and GCC for time delay estimation
Started by ●January 3, 2014
Reply by ●January 3, 20142014-01-03
On Friday, January 3, 2014 4:02:53 PM UTC-5, robert...@gmail.com wrote:> Hi guys, > > > > I have to determine the time lag between two signals x and y for an acoustic distance measurement setup. The signal x is the test input signal and y is the reflected signal from the acoustic path. This is modeled the following: > > > > y = h * y + N > > > > whereas N is additional gaussian noise and h is the impulse response of the acoustic path. (The operator * states for a convolution operator). > > > > My first approach for determining the time delay was correlation based. Doing a cross-correlation (CC) between the two signals x and y and take the maximum of the absolute of it. Here is a little Matlab example of this trivial approach: > > > > [Rxy, k] = xcorr(y, x); > > [~, loc] = max(abs(Rxy)); > > lag = k(loc); > > > > The performance of this was not that good since there is a distortion through the acoustic path and noise. > > > > I looked up this problem a bit on the internet and found the generalized cross correlation (GCC) which introduces a weighting function in the frequency domain. I tried these approaches but did not get any meaningful results respectively an improvement to a simple CC as described above. > > > > Consider for example the following snipped with a PHAT weighting function: > > > > N = max(length(x), length(y)); > > X = fft(x, N); > > Y = fft(y, N); > > Gxy = conj(Y) .* X; > > Gxy = Gxy ./ abs(Gxy); > > Rxy = fftshift(real(ifft(Gxy))); > > > > This does not yield a meaningful result. There is no correlation visible when plotting this. Also other weighting functions (ROTH, HT, SCOT) do not really show an expected result. > > > > Can anyone help and give me some advice why there is no improvement using GCC or what I'm doing wrong with it? > > > > Thank you in advance! > > Cheers RobertTry using N = length(x)+length(y)
Reply by ●January 3, 20142014-01-03
Hi, What exactly should be the improvement of increasing the fft length? Making the fft size larger than the signal would not increase the information in it - it would only do an interpolation wouldn't it? I have to say the that length of x is rather small in comparison to the length of y (200 samples vs 50k samples). Nevertheless I tried your suggestion but this does not show any improvements. Cheers Robert
Reply by ●January 3, 20142014-01-03
Hi, What exactly should be the improvement of increasing the fft length? Making the fft size larger than the signal would not increase the information in it - it would only do an interpolation wouldn't it? I have to say the that length of x is rather small in comparison to the length of y (200 samples vs 50k samples). Nevertheless I tried your suggestion but this does not show any improvements. Cheers Robert
Reply by ●January 3, 20142014-01-03
If your acoustic recordings were made in a highly reverberant environment , then this method does not work so well. Bob
Reply by ●January 3, 20142014-01-03
On 2014-01-04 00:56:59 +0000, radams2000@gmail.com said:> If your acoustic recordings were made in a highly reverberant > environment , then this method does not work so well.The environment is not that reverberant. The problem is more the noise. Doing a plain CC I can clearly see the correlation within the noise. I would estimate the noise amplitude as a gaussion distribution with parameters about N(0,3) to N(0,5) (roughly estimated). Doing a quick simulation (not the actual measurement, similar path impulse response, NO noise) I can determine the time lag with GCC. So what would be a good approach to deal with the noise? Robert
Reply by ●January 3, 20142014-01-03
On Sat, 4 Jan 2014 02:37:04 +0100, Robert Caltay <robert.caltay@gmail.com> wrote:>On 2014-01-04 00:56:59 +0000, radams2000@gmail.com said: > >> If your acoustic recordings were made in a highly reverberant >> environment , then this method does not work so well. > >The environment is not that reverberant. The problem is more the noise. >Doing a plain CC I can clearly see the correlation within the noise. I >would estimate the noise amplitude as a gaussion distribution with >parameters about N(0,3) to N(0,5) (roughly estimated). > >Doing a quick simulation (not the actual measurement, similar path >impulse response, NO noise) I can determine the time lag with GCC. > >So what would be a good approach to deal with the noise?Processing gain is usually one good way to deal with noise. If you can make N larger, that'll help, plus any other ways to get processing gain (e.g., oversampling and decimating, etc.). Eric Jacobsen Anchor Hill Communications http://www.anchorhill.com
Reply by ●January 4, 20142014-01-04
On Friday, January 3, 2014 3:02:53 PM UTC-6, robert...@gmail.com wrote:> Hi guys, > > > > I have to determine the time lag between two signals x and y for an acoustic distance measurement setup. The signal x is the test input signal and y is the reflected signal from the acoustic path. This is modeled the following: > > > > y = h * y + N > > > > whereas N is additional gaussian noise and h is the impulse response of the acoustic path. (The operator * states for a convolution operator). > > > > My first approach for determining the time delay was correlation based. Doing a cross-correlation (CC) between the two signals x and y and take the maximum of the absolute of it. Here is a little Matlab example of this trivial approach: > > > > [Rxy, k] = xcorr(y, x); > > [~, loc] = max(abs(Rxy)); > > lag = k(loc); > > > > The performance of this was not that good since there is a distortion through the acoustic path and noise. > > > > I looked up this problem a bit on the internet and found the generalized cross correlation (GCC) which introduces a weighting function in the frequency domain. I tried these approaches but did not get any meaningful results respectively an improvement to a simple CC as described above. > > > > Consider for example the following snipped with a PHAT weighting function: > > > > N = max(length(x), length(y)); > > X = fft(x, N); > > Y = fft(y, N); > > Gxy = conj(Y) .* X; > > Gxy = Gxy ./ abs(Gxy); > > Rxy = fftshift(real(ifft(Gxy))); > > > > This does not yield a meaningful result. There is no correlation visible when plotting this. Also other weighting functions (ROTH, HT, SCOT) do not really show an expected result. > > > > Can anyone help and give me some advice why there is no improvement using GCC or what I'm doing wrong with it? > > > > Thank you in advance! > > Cheers RobertCan you specify signal x? If so, use a signal that is easier to detect in noise, e.g. chirp.
Reply by ●January 4, 20142014-01-04
On 2014-01-04 23:04:22 +0000, maury said:> Can you specify signal x? If so, use a signal that is easier to detect > in noise, e.g. chirp.I was trying with a sine burst with 1 to 10 periods. The problem is really the measuremenet noise and how to deal with it. The amplitude of it is quite high
Reply by ●January 4, 20142014-01-04
Hi, a sine burst is a bad signal for delay estimation. You'll see why when you look at its crosscorrelation. It resembles itself too well. A chirp is a better choice, for example. Generally, use the available bandwidth, that is, ideally a constant power density (keywords: Cramer-Rao bound; time-of-arrival TOA). A sine pulse will result in a periodic autocorrelation function with a shallow peak but this doesn't sound like what you're describing (noise). So the problem may be something different. You can find two implementations for delay estimators here: http://www.dsprelated.com/showarticle/26.php. In the absence of noise, they'll achieve micro- and nanosample accuracy, respectively (correlation-based / phase-based). They are not guaranteed to work if the group delay varies strongly with frequency (as could be the case in an acoustic enviroment). Generally, zero-padding (as you are doing with fft(signal, N) is problematic as the result may get strongly biased towards maximizing the overlap between the signals. If your test setup allows, try to capture one cycle of a periodic test signal, when the output has reached steady state, that is all reverberations of the turn-on transient have decayed. _____________________________ Posted through www.DSPRelated.com