I am actually working on a project involving the cross-correlation of two signals. My cross-correlation code is working fine, but I suspect that I should apply a window to my data set in order to avoid spectral leakage.

As I am not AT ALL specialist of signal processing, I have a few questions :

  • My goal is to precisely track the maximum value of the cross correlation. Which type of window should I chose ?
  • Applying the window before zero-padding the data set is the good way to do it, right ?
  • Not really related to signal processing as a theory, but are the Accord Framework windowing functions efficient ?

Thanks a lot !


I suspect that you suspect that you need to window because there is a huge literature on windowing, but all things FFT, aren’t about window.

At a minimum, we use a boxcar window so it makes sense to consider other windows but if the noise in your application is flat over the band the signal occupies, the boxcar is very likely the appropriate window.

If the noise isn’t flat, a whitening filter is typically a better idea.

Spectral leakage is a problem when you have strong interference tones and the leakage masks a weaker set of tones that are your signal of interest. A signal of interest leaking on itself is not usually a problem. If you do have strong interference, an adaptive algorithm will provide an effective optimal window.

If accuracy is your main concern you really should be asking yourself what the bounds on accuracy will be and that will be governed more by FFT size, how many averages and what kind of averaging you do, which also leads to issues like how much your received signal changes.

The subject can be complicated. There are literally thousands of papers in the IEEE library that touch on the subject. You can dedicate yourself to thousands of hours of study, or you can just try a few windows on some data and pick one.

In many situations, a customer will not be interested in details, but some customers will and you can find yourself being asked questions about issues that you didn’t know existed.

I suggest you should know what a Cramer-Rao bound is and what it is for your problem, and Pearson Correlation.

So some answers.

If you minimally averaging, a window smooths the cross correlation. If you are minimally averaging, don’t throw away data. There are too many factors to pick a specific type. You need to experiment.

If you window, do so prior to zero padding.

  • $\begingroup$ Thanks a lot for your answer, I guess the problem is a bit more complicated than I previously thought. I suspected I needed windowing because of this issue I posted about before. I ended up trying a Blackman window, and it greatly reduced my peak issue. I am going to take your message into account, as well as try other windows, and very likely try what Cedron proposed. Thanks again. $\endgroup$
    – Trion
    May 18 '18 at 9:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.