12
$\begingroup$

I am trying to understand how exactly to implement what is known as a 'pre-whitening' filter or simply a 'whitening' filter.

I understand that the purpose is to make it have a delta as its autocorrelation function, but I am not sure how to do this exactly.

The context here is the following: A signal is received at two different receivers, and their cross-correlation is computed. The cross-correlation can look like a triangle, or some other godforsaken shape. Due to this, it becomes hard to find the peak of the cross-correlation signal. In this case I hear about having to 'whiten' the signals before a cross correlation is performed on them, such that the cross-correlation is now more delta-like.

How is this done?

Thanks!

$\endgroup$
  • $\begingroup$ Note that in the context of communications systems, what your question described as a whitener is essentially performing the function of an equalizer. It sounds the same to me; it might just be different nomenclature. $\endgroup$ – Jason R Nov 12 '11 at 5:10
  • $\begingroup$ Yes, the ill-defined nomenclature makes it all the more confusing as to what they are trying to do sometimes. $\endgroup$ – Spacey Nov 13 '11 at 18:08
7
$\begingroup$

Suppose you have signals $x(t)$ and $y(t)$ whose cross-correlation function $R_{x,y}(t)$ is not something you like; you want $R_{x,y}$ to be impulse-like. Note that in the frequency domain, $$\mathcal{F}[R_{x,y}] = S_{x,y}(f) = X(f)Y^*(f).$$ So you filter the signals through linear filters $g$ and $h$ respectively to get $\hat{x}(t) = x*g$, $\hat{X}(f) = X(f)G(f)$, and $\hat{y} = y*h$, $\hat{Y}(f) = Y(f)H(f)$, and now their cross-correlation function is $R_{\hat{x},\hat{y}}$ whose Fourier transform is $$\begin{align*} \mathcal{F}[R_{\hat{x},\hat{y}}] = S_{\hat{x},\hat{y}}(f) &= [X(f)G(f)][Y(f)H(f)]^*\\ &= [X(f)Y^*(f)][G(f)H^*(f)]\\ &= [X(f)Y^*(f)][G^*(f)H(f)]^*, \end{align*}$$ that is, $R_{\hat{x},\hat{y}}$ is the cross-correlation of $R_{x,y}$ with $R_{h,g}$. More importantly, you want to choose $g$ and $h$ so that the cross-spectral density $G(f)H^*(f)$ of $g$ and $h$ is the multiplicative inverse of the cross-spectral density $X(f)Y^*(f)$ of $x$ and $y$, or something close to it. If you have only one signal and one filter, then you get the result given by Hilmar (with amendment as given by my comment there). In either case, the issue of compensating for spectral nulls, or generally, frequency bands where the signals have little energy still remains.

$\endgroup$
  • $\begingroup$ Thanks for the asnwer - can you explain the lengths involved here? For example, what is the length of the power transfer function of X, if x[n] is of length N? (Same with y...) $\endgroup$ – Spacey Nov 16 '11 at 19:06
  • $\begingroup$ Ok - I will accept the answer, but will write a brand new question taking off on this sometime this evening and we can take it from there. Thanks again. $\endgroup$ – Spacey Nov 16 '11 at 20:19
7
$\begingroup$

Pre-whitening can be done by filtering with a transfer function that is roughly the inverse of the power spectrum of the signal. Let's say you have an audio signal that's roughly pink. In order to whiten that, you would apply an inverse pink filter (frequency response rises by 3 dB per octave).

However, I'm not sure whether this will help with your issue. Pre-whitening tends to amplify the low energy parts in the signal, which can be noisy and therefore increase the overall noise in your system. If you are trying to determine whether two signals are time aligned (or what the time alignment is) then there is some inherent fuzziness in the problem that's related to the bandwidth of the signal. That is exactly represented in the time domain shape of the autocorrelation function. 

$\endgroup$
  • $\begingroup$ Thanks for your answer - yes inverting the spectrum as you said will probably not work here... the use of 'pre-whiteners' seems so ubiquitous I tend to think there are many ways of doing it besides that?... $\endgroup$ – Spacey Nov 11 '11 at 19:22
2
$\begingroup$

There is a generally simple method of whitening a vector $\bf x$ given an example data set. It is not clear from your question if the dimension of $\bf x$ would be 2 or if you are including a sliding temporal window. Anyway you want to decorrelate the components of $\bf x$. Doing it in the frequency domain for such a simple problem is arduous.

Assuming that you start with an example data set consisting of samples of the data vectors - this might be a set of samples of the two signals at different times. You subtract the data set mean so that the mean of $\bf x$ is zero. Then you need to compute the covariance matrix of the data $C_{ij} = \frac{1}{N}\sum_{{\bf x}\in Data}x_i x_j$ where $N$ is the number of data examples and $i,j$ are indices of the components of $\bf x$, which if there are 2 signals just go from 0 to 1. The covariance matrix in this case will just be 2x2.

Once you have this covariance matrix you can compute a whitening transform in the form of a matrix to multiply the data in order to get the whitened version. The covariance of this new whitened data is the identity matrix.

The whitened data will be ${\bf y} = C^{-1/2}{\bf x}$. This is just a matrix version of calculating the variance over an example dataset and then dividing any new data by the square root of the variance in order to normalize its standard deviation.

You can calculate $C^{-1/2}$ by using Cholesky decomposition where $C=LL^T$. For a 2x2 matrix it is very easy using simple algebra. The whitened data is given by ${\bf y}=L^{-1}{\bf x}$, which since $L$ is lower triangular can efficiently be computed by common solvers without forming the inverse.

$\endgroup$
0
$\begingroup$

If it's just about how to filter the low energy parts in the signal, could you use a lowpass filter? There are some implementations about this.

If this his helpful: This article from Karjalaien et. al is about the whitening filter and the method of warped linear prediction, which is used by the filter.

$\endgroup$

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.