MATLAB Answers


Normalizing correlation coefficients for sequences of unequal length without unnecessary zero padding

Asked by Rohan
on 16 Nov 2012

I have 2 questions:

1. Can some one explain why normalization{unbiased} of cross-corelation coefficents is carried out? I want to understand this at an intuitive level and not a mathematical one.

2. I have written my own code to carry out cross corelation between 2 sequences. The sequences are of unequal length. The code has been written in such a way that only the longer sequence has to be zero padded and that to only to the length of the smaller sequence-1.

How am I supposed to carry out normalization in this case?

Kindly help me figure this out.


Log in to comment.

3 Answers

Answer by Wayne King
on 17 Nov 2012
 Accepted Answer

If you are estimating the autocorrelation of a random process or cross correlation of two wide sense stationary processes then you are just obtaining the estimate of the true autocorrelation or cross-correlation. The normalizations used in xcorr() 1/N and 1/(N-abs(lag)) are just two ways of constructing the sample expectation (as an estimate of the true expectation, which you cannot compute).

Just like 1/N in computing the mean represents the expectation operator. 1/N in the sample mean results in an unbiased estimate of the mean, for the cross-correlation sequence, you have to take into account the lag to come up with an unbiased estimate. Note that in time-series analysis, the biased estimate is actually preferred in many cases.

If you have different length input vectors, then you should not scale the output.


Log in to comment.

Answer by Rohan
on 17 Nov 2012

Gentle bounce.


Log in to comment.

Answer by Rohan
on 17 Nov 2012

The issue that I just cannot wrap my head around id this:

Irrespective of whether I carry out biased normalization or unbiased normalization or no normalization whatsoever, the correlation coefficients still give me the same information.

As in, by looking at the correlation coefficients I can make out the nature of variability of the signals and the spectral bandwidth of the common signals.

So, how does normalization help at all?

  1 Comment

If I scale to get a peak of 1 for autocorrelation, I get a warm fuzzy feeling when I get 0.76 for crosscorrelation at zero lag because I think I know how similar the functions are.

If I don't scale to get a peak of 1 for autocorrelation, I have to look at both autocorrelation curves to try to interpret the crosscorrelation curve.

Log in to comment.

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today