# LabVIEW

cancel
Showing results for
Did you mean:

Highlighted

## cross correlation and delay time 16 signal

hello im a new labview users

i need your help

i have 16 microphone and i want to know time delay between any microphone because i want to estimate location of sound source with cross correlation method.

what the difference of lagging time, phase shifter and time delay?

i got example from this forum, but i don't understand why the signal minus with 99?

and please help me to get delay time and lag time in my signal

thank you

Message 1 of 3
(1,520 Views)

## Re: cross correlation and delay time 16 signal

what the difference of lagging time, phase shifter and time delay?

Say you have a signal that starts at time t0 and plays for some time T.  Now consider the same signal that starts at time t0+dt, that is, a short time later.  This "time later", dt, is the time you have delayed your signal, hence is a "time delay".  You can also say that the second signal "lags" the first by a time dt.

Now let the signal be a sinusoid having frequency f, i.e. it can be described as A sin (2 pi f t).  If we delay this sinusoid by dt, A sin (2 pi f (t+dt)), we can also write it as A sin (2 pi f t - theta), where theta is - 2 pi f dt.  Note the units of theta -- it is dimensionless, but can be considered an angle in radians.  When written this way, Theta is usually called the "Phase" of the sinusoid.  Why the minus signs?  When the signal is delayed, we usually speak of a Phase lag, which (by convention) is negative, hence the sign convention.

I recommend learning a little Signal Theory.

Bob Schor

Message 2 of 3
(1,478 Views)

## Re: cross correlation and delay time 16 signal

To answer your specific question about cross correlation (Xcorr) and the '99' samples value. The example you are showing is unfortunately extremely 'hard-coded' an the value of 99 is really derived from the two signals you are cross correlating that each consists of 100 samples (one being a subset).

As Bob mentioned it would be good for you to learn about the purpose and behavior of the different processing funtions but if you look at the context help for the Cross Correlation VI it actually graphically shows you the result of a Xcorr operation between a 200 samples and a 100 samples signal, peaking at the 150th sample (index 149).

Cross correlation is very powerful (but not a miracle medication - Note 1) to estimate the time shift between two highly correlated signals (like hopefully your 16 audio signals) but it requires you to:

1 - find the absolute maximum location of the Xcorr result

2 - correct you maximum location 'delay' for the length of the correlating signal.

3 - use common sense (and later experience) to evaluate the correctness of your result by inspection of the Xcorr signal itself. Is you maximum obvious or do you get other near-maxima at expected/unexpected locations? So always question your results and repeat the measurements using different source signals to confirm!

Note 1: Cross correlation is risky business to use on periodic signals, as you may find maxima for every signal periods (which one represents the actual delay?).

Note 2: You can get very good delay estimates using Xcorr if you use relatively short subset of signals with least periodicity. Of course your subset should be longer than your signal of interest AND expected delay so the portions of interest are clearly represented in both of your signals. Impulse responses are good examples of signals suited for Xcorr analysis, can you control the signals being acquired on your 16 channels? If so try to generate impulse-like signals, I assume it's intuitively more obvious to see time delay between two pulses than two sine waves.

Message 3 of 3
(1,444 Views)