Re: cross correlation and FFT problem



Hi,

Be careful about the length of the FFT; you need a length at least the
sum of the lenghts of the two sequences minus one. The reason is that
the frequency domain operation is really a circular convolution.

If you end up requiring a weird FFT length you may want to take a look
at my FFT routine available from my homepage.

Best regards,
Jens J. Nielsen
http:/home.get2net.dk/jjn

On Mon, 04 Jul 2005 15:10:32 -0500, "signal" <monirov@xxxxxxxxxxx>
wrote:

>Hi my friends,
>I don't find solution for this, i give you the example
>i have two signals
>x=[1 0 1 1 2 3 4 4 1 0 1 0 1];
>y=[1 1 1 1 1 1 2 3 4 4 1 0 1 0 1];
>I calculated cross correlation with xcorr in matlab
>z=xcorr(x,y), length(z)=2*max(length(x),length(y))-1
>[m,I]=max(z)
>m=51, I=17
>i'm trying to compare this to rxy
>L=max(length(x),length(y))
>NFFT=2*L
>xx=fft(x,NFFT)
>yy=fft(y,NFFT)
>Sxy=xx.*conj(yy)
>rxy=fftshift(real(ifft(Sxy)));
>[k,J]=max(rxy)
>k=51
>J=14
>my question is why I is different to J
>may be the NFFT is not correct, can you help me please
>thanks a lot
>
>
>
>
>
>This message was sent using the Comp.DSP web interface on
>www.DSPRelated.com

.



Relevant Pages

  • Re: FFT algoritms
    ... trying to infer, from the illustration, what the rhyme or reason there ... place algorithms without bit-reversal. ... if you compare a highly optimized in-order FFT like FFTW ... One reason to be cautious here is that O&S is comparing apples and ...
    (comp.dsp)
  • Re: FFT Guitar Tuner - decimal precision (Hz)
    ... That formula should be something like (index/length of FFT) ... was stronger by about 2% at 110.1Hz than 110.0 Hz. ... frequency smear things out worse than a big honking zero pad? ... for some reason I pictured the problem as "three". ...
    (comp.soft-sys.matlab)
  • Pre-emphasis for speech recognition
    ... Usually for speech recognition pre-emphasis is performed in the time ... domain using a filter before windowing, FFT, etc. ... Is there any reason why it's not usually done this way? ...
    (comp.speech.research)
  • Re: FFTW on DSP
    ... > based custom target board and for some reason the fft library / code i ... > downloaded from Texas instruments website doesn't work for more than 4k ... This is more than likely due to restrictions on internal memory (fast ... The library may also be limiting your largest fft ...
    (comp.dsp)