I'm using cross-correlation to look for a Barker code in a BPSK signal. It occurred to me that if I send out a zero DC valued signal proceeding the barker code, it won't affect the correlation because a zero DC signal has zero correlation with any other signal.

This made me wonder if there's an alternative to cross-correlation which would work properly for a zero valued signal. As an example, it seems intuitive that a signal such as [0,0,0,0,0] is closer to [.5,.5,.5,.5,.5] than it is to [1,1,1,1,1]

More generally, it seems like correlation is throwing away information that would be useful for doing better matching and I'm wondering how to fix this.

  • 1
    $\begingroup$ How do you tell if you have a "zero-valued" signal being transmitted? In (antipodal) BPSK, the signal output from the filter is either $+x(t)$ or $-x(t)$, and, assuming that things are not so badly screwed up that you are sampling the filter output at an instant when $x(t)$ is $0$, you are getting an output that is nonzero (with probability $1$), and never a $0$. $\endgroup$ Jul 23, 2013 at 14:48
  • $\begingroup$ Yes, I'm assuming the signal isn't pure antipodal BPSK. It seems that a low-energy signal proceeding a high-energy BPSK signal is additional information that ideally the correlator could use. Perhaps what I'm asking for is a correlator that accounts for both signal shape and signal energy. $\endgroup$ Jul 23, 2013 at 16:54

1 Answer 1


The Correlator is really just a Maximum Likelihood detector. If your noise is AWGN, (Additive White Gaussian Noise), then the correlator is optimal in the Least-squares sense. This is because a correlator is doing a match filtering with your incoming signal, and in this sense, will only consider DFT bands where SNR is the highest, or rather, only consider DFT bands where your signal energy exists.

"This made me wonder if there's an alternative to cross-correlation which would work properly for a zero valued signal."

Regarding the second paragraph, the 'signal' you are trying to 'correlate' against, [0 0 0 0 0], has zero energy, so the above would not apply. It does not have to do with its mean (DC band of the DFT is null), it has to do with the fact that it has no energy. (All DFT bands are null). In a special case such as this, then you could perform:

$$ e[n] = \sum_{n=0}^{N-1} |x[n] - y[n]| $$

where $x[n]$ is your known signal, and $y[n]$ is your given signal. In effect, this is nothing but the L1-norm of the difference of vectors. You would then pick the $y[n]$ vector that minimizes this error.

(Note that if your 'known signal' is always the zero vector, then this collapses to simply the L1-norm of your given vector. The one with the lowest L1-norm is the one closest to the zero vector).

In contrast with the matched filter, this metric will not suffer if your 'signal' has no energy.

  • $\begingroup$ Just a quick addition, this metric will suffer if the reference signal is not zero everywhere and the received signal has been inverted for some reason. Or, if this is about complex signals, if the received signal has undergone a (large) phase rotation. With the correlator, these cases can be handled better. $\endgroup$
    – jan
    Jul 23, 2013 at 15:31
  • $\begingroup$ @jan Yes, but I am simply addressing his question here: "This made me wonder if there's an alternative to cross-correlation which would work properly for a zero valued signal.". $\endgroup$ Jul 23, 2013 at 15:38
  • $\begingroup$ I'm surprised there isn't a correlator that could correlate optimally against "SinWave-Silence-SinWave" in one shot. Wouldn't this for example be useful for detecting a barker pulse train that consisted of zeros and ones, for example? $\endgroup$ Jul 24, 2013 at 7:40
  • $\begingroup$ @DanSandberg Barker codes do not have zeros. Barker codes consist of either 1s or -1s and have a white power spectral density. $\endgroup$ Jul 24, 2013 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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