Re: anyone have an answer to this?



On Apr 7, 6:37=A0am, "bronx" <branko_blagoje...@xxxxxxxxxxx> wrote:
Hi there,

Just wondering if this question was answered...I know it is an old
post,
but just taking a long shot here. Essentially I am getting the same
outcome...specifically, in matlab, I can generate an appropriate
correlation plot, and retrieve the correct delay with xcorr...as well
as
using the TF method : max(ifft(fft(x1).*conj(fft(x2))), i.e. through
regular cross correlation.

However, when I try to retrieve phase correlation:
X1 =3D fft(x1);
X2 =3D fft(x2);
numerator =3D X1.*X2;
PhaseCorr =3D fftshift(ifft((numerator)./abs(numerator)));

I don't get the kroeneker delta that I should be getting in the
correct
delay position. What am I doing wrong???

My signals (x1, and x2) are two sinusoids of freq f and delay T
between
each other, and length N samples...they have been zero padded with
N-1
extra zeroes.

Does someone have a solution to this probem.

What exactly is "phase correlation"? Give me a description, not
equations.

Where do you expect the delta to be?

Why do you expect to get a delta function out of what you are doing?

Dirk


Hi,

sorry, I should have been more clear...I am trying to perform the
generalized cross correlation PHAT (phase transform). This is also
sometimes called normalized cross correlation. This is essentially a
regular cross correlation algorithm in the frequency domain, for two
signals, divided by the absolute value of the product of one signal and
the conjugate of the other. for example:

PHAT = X1.*conj(X2)./abs(X1.*conj(X2))

If the signals are just a delayed version of each other, then the
inverse
fourier transform of the PHAT should provide a plot of the signal with a
kronecker delta in the location of the time delay between the two time
shifted signals. I am looking for this time delay.
More detail regarding the algorithm is found here.
http://en.wikipedia.org/wiki/Phase_correlation

My issue is that when i plot this in matlab using the following code to
retrieve the delay information using the following code:

(x1 and x2 are equivalent sinusoids (N samples in 20ms segment) delayed
by
time T from one another)
time = 20ms;
x1pad = [x1 zeros(N-1)];
x2pad = [x2 zeros(N-1)];
X1 = fft(x1pad);
X2 = fft(x2pad);
numerator = X1.*X2;
PhaseCorr = fftshift(ifft((numerator)./abs(numerator)));
y = time*linspace(-1,1, 2*N-1);
plot(t,PhaseCorr);
[maxAmp maxIndex] = max(PhaseCorr);
Tretrieved = t(maxIndex);

I don't get a delta at time Tretrieved (which is the retrieved T delay)
as
I should....When I plug in normal correlation (i.e. remove
'./abs(numerator)' in the code above, then I do get a maximum in the
right
time interval T. Instead my maximum point under the PHAT algorithn
(which
is not very large in amplitude) is closer to the origin rather than at
time T.
The problem with using the regular CC method is that it really gets
messy
when there are multiple sinusoids in the signal, and multiple delays
between them. I read that weighting CC algorithms such as the PHAT, SCOT
and Hanan Thomson transform are typically used for the retrieval of a
time
delay because they are more robust to noise, and signal overlay...and
most
papers suggest the PHAT one in particular.

So, my question is whether I am doing something wrong, judging from the
code above...why am I getting the right delay for regular cross
correlation, but not for the PHAT algorithm...

Any suggestions??



Sorry made a mistake in the code above...its actually:
numerator = X1.*conj(X2); %I didnt forget the conjugate in my actual code
.



Relevant Pages

  • Re: anyone have an answer to this?
    ... correlation plot, and retrieve the correct delay with xcorr...as well ... when I try to retrieve phase correlation: ... My signals are two sinusoids of freq f and delay T ...
    (comp.dsp)
  • Re: PREEMPT_RT vs I-PIPE: the numbers, part 2
    ... >> of the maximum delay assumes that the maximum delays for the logger ... What causes this correlation? ... > being measured is twice the latency of the ipipe in that specific ...
    (Linux-Kernel)
  • Re: GCC Clarity.
    ... %The time duration of the signal. ... %%%This is where the correlation is done. ... %%Setting up a time lag axis. ... This is the code where i compute the delay factor. ...
    (comp.dsp)
  • Re: cross correlation delay
    ... The max of z represents the point where the correlation between m1 and m2 is ... this point will correspond to the delay between the two signals. ... So, when you find the index of your cross-correlation maximum, you need to ...
    (comp.soft-sys.matlab)
  • Re: cross correlation delay
    ... The max of z represents the point where the correlation between m1 and m2 is ... this point will correspond to the delay between the two signals. ... So, when you find the index of your cross-correlation maximum, you need to ...
    (comp.soft-sys.matlab)