# What is the difference between normalized peak of correlation, versus peak of correlation divided by its average?

Given a template, and a signal, the question arises as to how similar the signal is to the template.

Traditionally a simple correlation approach is used, whereby the template and a signal are cross-correlated, and then the entire result normalized by the product of both their norms. This gives a cross-correlation function that can range from -1 to 1, and the degree of similarity is given as the score of the peak therein.

• How does this compare to taking the value of that peak, and dividing by the mean or average of the cross-correlation function?
• What am I measuring here instead?

Attached is a diagram as my example. In order to get the best measure of their similarity, I am wondering if I should look at:

1. Just the peak of the normalized cross-correlation as shown here?

2. Take peak but divide by the average of the cross-correlation plot?

3. My templates are going to be periodic square waves with some duty cycle as you can see - so should I not also somehow exploit the other two peaks we see here?

• What would give the best measure of similarity in this case?

Thanks!

EDIT For Dilip:

I plotted the cross-correlation squared VS a cross-correlation that isnt squared, and it certainly does 'sharpen' the main peak over the others, but I am confused as to what calculation I should be using to determine similarity...

What I am trying to figure out is:

1. Can/Should I use the other secondary peaks in my calculations of similarity?

2. We have a squared cross-correlation plot now, and it certainly sharpens the main peak, but how does this help in determining final similarity?

Thanks again. EDIT For Dilip:

The smaller peaks don't really help in similarity calculations; it is the main peak that matters. But the smaller peaks do provide support for the conjecture that the signal is a noisy version of the template. "

• Thanks Dilip, I am a little confused by that statement - if the smaller peaks do in fact provide support that the signal is a noisy version of the template, then doesnt that also aid in a measure of similarity?

What am I confused about is whether I should simply use the peak of the normalized cross-correlation function as my one and final measure of similarity and 'not care' about what the rest of the cross-corr function does/looks like, OR, should I take the peak value and some_other_metric of the cross-cor into account as well.

• If only the peak matters, then how/why would squaring the function help, since it just magnifies the main peak relative to the smaller ones? (More noise immunity?)

• Long and short: Should I care about the peak of the cross-correlation function only as my final measure of similarity, or should I also take the entire cross-correlation plot into account as well? (Hence my thought about looking at its mean).

Thanks again,

P.S. Time delay in this case is not a problem, in that, it is 'not cared' about for this application. P.P.S. I do not have control over the template.