Ramoj Paruchuri wrote:> Hi All, > I have some weird results....Ok! Let me explain what I did > > inA[2N]; inB[2N] are my 2 input arrays which has real no.s in it. > <for now lets say, 2N is either -- 2, 4, 16, 32, ....> > > I had used FFTWs to calculate FFTs. > outA[N+1][2] = FFTW_r2c (real_to_complex) { inA[2N] } > outB[N+1][2] = FFTW_r2c (real_to_complex) { inB[2N] } > > Where [][0] = real part; [][1] = img. part; > > Then, outB'[N+1][2] = conjugate of { outB[N+1][2] } > (a+ib = conjugate of a-ib) -- if my math is not wrong. > > Then I found outC[N+1][2] = outA[N+1][2] * outB'[N+1][2]; > Then used the regular 1d complex BACKWARD Tranform function in FFTW to > find outD[N+1][2] = FFTW_1d_ (complex to complex, backward) > (outC[N+1][2])Did you zero pad the input sequneces? Remember when you convolve a sequence of length M with a sequnce of length N, the result is a sequence of length M+N-1.> > Then does the Values in the real. part of that outD mean correlation > coefficients? > if yes, the highest correlation coeff Index is different from that > obtained from a normal/regular cross-correlation. > > I am not very sure what I am doing wrong above...Any help is highly > appreciated. > Thanks, > Ramoj

# Correlation of 2 Sequences using FFT (W/W.O FFTW)

Started by ●July 14, 2004

Reply by ●July 20, 20042004-07-20

Reply by ●July 20, 20042004-07-20

I came pretty close. I am now able to generate the coefficients. But I am missing something, how do I relate these coefficients with the cross correlation values 0 - 1. Ramoj P.S: I am thinking..on do I do this for my problem. But, how is it done in general? Any ideas will be highly appreciated. :) Rune...???

Reply by ●July 21, 20042004-07-21

Ramoj Paruchuri wrote:> I came pretty close. I am now able to generate the coefficients. > But I am missing something, how do I relate these coefficients with > the cross correlation values 0 - 1.I think that its actually on the range from -1 to 1.> > Ramoj > P.S: I am thinking..on do I do this for my problem. But, how is it > done in general? Any ideas will be highly appreciated. :) Rune...???It kind of depends. You can normalized each waveform by the square root of its energy or the square root of its power. With FFT's you typically have some factors like 1/N or 1/sqrt(N) lurking around depending on the convention that the package author likes using. I typically like to divide each wave form by the square root of the zero lag of its autocorrelation.

Reply by ●July 22, 20042004-07-22

Stan Pawlukiewicz <spam@spam.mitre.org> wrote in message news:<cdgil4$81n$1@newslocal.mitre.org>...> Rune Allnor wrote: > > ramojparuchuri@gmail.com (Ramoj Paruchuri) wrote in message news:<30d8ae8b.0407160625.5c522f56@posting.google.com>... > > > > > >>Rune: I tried for that book, but surprisingly Barnes & Noble doesnt > >>have a copy in any of their stores. > > > > > > I'm not all that surprised that the bookstores don't have that book. > > I don't know many people who actually own (or have available) a copy, > > but all four of them work with real-world data analysis as opposed > > to academic research or teaching. If a book is not used in a class, > > it will not be available in the bookstores. > > I saw Bendat and Piersol's book at the Fairlakes Barnes and Noble in > Fairfax, VA , USA about a month ago. I didn't have a chance to browse > through it. I own the 2nd edition, does anyone have any comment on the > 3rd edition?According to the preface of Random Data, 3rd ed., (RD3), it is a complete rework or Random Data, 2nd ed, (RD2). RD2 was written some time in the early eighties. Around 1993, Bendat & Piersol co-wrote a book on engineering applications of correlation and spectrum analysis, while Bendat wrote a book on non-linear aspects of such analysis in 1998. Apparently, RD3 incorporates lots of concepts frome these two intermediate books, in addition to the material treated in RD2.> worth updating?I don't know, since I haven't seen RD2. However, if you choose to buy the 1993 or 1998 books, you would certainly want to keep your copy of RD2. Both later books refer to specific chapters and equations of RD2. These moments are probably there in RD3 as well, but are difficult to find due to the restructuring of the Random Data text. Rune

Reply by ●July 22, 20042004-07-22

Rune Allnor wrote:> Stan Pawlukiewicz <spam@spam.mitre.org> wrote in message news:<cdgil4$81n$1@newslocal.mitre.org>... > >>Rune Allnor wrote: >> >>>ramojparuchuri@gmail.com (Ramoj Paruchuri) wrote in message news:<30d8ae8b.0407160625.5c522f56@posting.google.com>... >>> >>> >>> >>>>Rune: I tried for that book, but surprisingly Barnes & Noble doesnt >>>>have a copy in any of their stores. >>> >>> >>>I'm not all that surprised that the bookstores don't have that book. >>>I don't know many people who actually own (or have available) a copy, >>>but all four of them work with real-world data analysis as opposed >>>to academic research or teaching. If a book is not used in a class, >>>it will not be available in the bookstores. >> >>I saw Bendat and Piersol's book at the Fairlakes Barnes and Noble in >>Fairfax, VA , USA about a month ago. I didn't have a chance to browse >>through it. I own the 2nd edition, does anyone have any comment on the >>3rd edition? > > > According to the preface of Random Data, 3rd ed., (RD3), it is a > complete rework or Random Data, 2nd ed, (RD2). RD2 was written some > time in the early eighties. Around 1993, Bendat & Piersol co-wrote > a book on engineering applications of correlation and spectrum analysis, > while Bendat wrote a book on non-linear aspects of such analysis in 1998. > Apparently, RD3 incorporates lots of concepts frome these two intermediate > books, in addition to the material treated in RD2. > > >>worth updating? > > > I don't know, since I haven't seen RD2. However, if you choose to buy > the 1993 or 1998 books, you would certainly want to keep your copy of RD2. > Both later books refer to specific chapters and equations of RD2. These > moments are probably there in RD3 as well, but are difficult to find > due to the restructuring of the Random Data text. > > RuneThanks for the comments.

Reply by ●July 22, 20042004-07-22

> I think that its actually on the range from -1 to 1.Ofcourse, but I was kind of more inclined to know the positive correlaton...> It kind of depends. You can normalized each waveform by the square root > of its energy or the square root of its power. With FFT's you > typically have some factors like 1/N or 1/sqrt(N) lurking around > depending on the convention that the package author likes using.Hmm..> I typically like to divide each wave form by the square root of the zero > lag of its autocorrelation.So, you normalize each of the waveform (from auto correlation) before you cross correlate these waveforms? Is there any other way that I just play on the lag coefficients.... Also, I am getting better number of correlations when I take the waveforms as cyclic rather than zero padding...is this a trend in general? Thanks in adv. for you suggestions and help. Ramoj

Reply by ●July 22, 20042004-07-22

Ramoj Paruchuri wrote:>>I think that its actually on the range from -1 to 1. > > > Ofcourse, but I was kind of more inclined to know the positive > correlaton... > > > >>It kind of depends. You can normalized each waveform by the square root >> of its energy or the square root of its power. With FFT's you >>typically have some factors like 1/N or 1/sqrt(N) lurking around >>depending on the convention that the package author likes using. > > > Hmm.. > > >>I typically like to divide each wave form by the square root of the zero >>lag of its autocorrelation. > > > So, you normalize each of the waveform (from auto correlation)zero lag of autocorrelation before> you cross correlate these waveforms? Is there any other way that I > just play on the lag coefficients....It depends on the aplication. For a time delay estimate, you essentially only need the location of the peak.> > Also, I am getting better number of correlations when I take the > waveforms as cyclic rather than zero padding...is this a trend in > general?Explain "better"> > Thanks in adv. for you suggestions and help. > Ramoj