Re: cross correlation and FFT problem
- From: Jens Jørgen Nielsen <jxjxn@xxxxxxxxxx>
- Date: Wed, 28 Sep 2005 22:58:44 +0200
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
.
- Follow-Ups:
- Re: cross correlation and FFT problem
- From: Bob Cain
- Re: cross correlation and FFT problem
- Prev by Date: Re: fractional-sample delay filtering
- Next by Date: Re: Top Notch Semiconductor Company calls for DFT Engineers
- Previous by thread: Calculating Damping Ratios of a structural response
- Next by thread: Re: cross correlation and FFT problem
- Index(es):
Relevant Pages
|