DSPRelated.com
Forums

What is the intuitive thought behind the cross-correlation function?

Started by kiki October 20, 2004

Kedi wrote:

> In the discrete world, correlation tells you the sum of > the squares of the difference between 2 signals, which is a very > useful parameter in many applications.
D'oh. How on earth did I not know this. Thanks, Kedi. A nit, shouldn't you be using the term "inner product" where you use "correlation" in your post? Correlation is the sliding inner product. Bob -- "Things should be described as simply as possible, but no simpler." A. Einstein
Hi Bob,

I guess you are quite right since we are talking about signal
processing here.

I was not very conscious when I use the word "correlation". For me,
when I think of correlation, the first thing that comes to my mind is
how it is typically used in statistics, i.e. correlation coefficients.
Inner product is a mathematical operation. Correlation is a measure of
relations between sets of data (hence, not necessarily defined as
inner products). Whether it can/will be sliding depends on the nature
of the data. Sliding is only possible when you use samples taken from
populations or taken from larger samples.


Here is a minor correction of what I wrote:

(1-normalized correlation value) is equal to the half of the energy of
the difference between 2 functions. (Bear in mind the pre-requisite
that the energy of f has to be equalized to g first.)


There is one more thing I forgot to mention in my earlier post:

The fact that similar signals have higher correlations, in principle,
is not related the positivity or negativity of their products. It only
has to do with the mathematical nature of squares.

In the discrete world, the principle of correlation is based on:

  (a+b)^2 >= 0  
=> a^2 + b^2 >= a*b + a*b 

Or in the extended form:

=> Sum(x(i)^2) >= Sum(x(i)*x(j)) (i not equal j)


x(i) can be all positive or all negative.

Take 2 sequences of length 2 for example:
f: 2, 9
g: 6, 7

xcorr(f,f) = 85, xcorr(g,g) = 85
xcorr(g,f) = 75, xcorr(reverse(g),f) = 68


My $0.02

Regards.

KD
On 2nd thought, Bob, you are not "quite right". You are "absolutely
right" in saying that I should have used the word "inner product" in
all my previous posts.



Bob Cain <arcane@arcanemethods.com> wrote in message news:<clcfb70jns@enews4.newsguy.com>...
> Kedi wrote: > > > In the discrete world, correlation tells you the sum of > > the squares of the difference between 2 signals, which is a very > > useful parameter in many applications. > > D'oh. How on earth did I not know this. Thanks, Kedi. > > A nit, shouldn't you be using the term "inner product" where > you use "correlation" in your post? Correlation is the > sliding inner product. > > > Bob

Kedi wrote:
> On 2nd thought, Bob, you are not "quite right". You are "absolutely > right" in saying that I should have used the word "inner product" in > all my previous posts.
As I said, just a nit. The real content was illuminating for me. One of the problems with being self taught is that the lack of a disciplined course can result in a hit or miss base of knowledge. Thanks for filling a gap. Bob -- "Things should be described as simply as possible, but no simpler." A. Einstein
Bob Cain <arcane@arcanemethods.com> wrote in message news:<clf0jt01vlm@enews2.newsguy.com>...

> As I said, just a nit. The real content was illuminating > for me. One of the problems with being self taught is that > the lack of a disciplined course can result in a hit or miss > base of knowledge.
Based on your track record, it is appears to be mostly misses and few if any sutstantive hits.

Kedi wrote:

> In the discrete world, correlation tells you the sum of > the squares of the difference between 2 signals, which is a very > useful parameter in many applications.
On further thought, this doesn't seem right. As an example, consider the inner product of an impulse with the response of a system to that impulse. The result certainly won't be the squared error. Have I mininterpreted your result? Bob -- "Things should be described as simply as possible, but no simpler." A. Einstein

The Ghost wrote:

> Bob Cain <arcane@arcanemethods.com> wrote in message news:<clf0jt01vlm@enews2.newsguy.com>... > > >>As I said, just a nit. The real content was illuminating >>for me. One of the problems with being self taught is that >>the lack of a disciplined course can result in a hit or miss >>base of knowledge. > > > Based on your track record, it is appears to be mostly misses and few > if any sutstantive hits.
Print this out and take it to your next therapy session. http://www.apa.org/journals/psp/psp7761121.html I'm sure your mental health professional will appreciate the insight it gives relative to your pathology. It'll be alright, Gary. New drugs are emerging for about any mental ailment so relief shouldn't be that far away for you. Bob -- "Things should be described as simply as possible, but no simpler." A. Einstein
On Wed, 20 Oct 2004 10:03:37 +0200, Stephan M. Bernsee
<spam@dspdimension.com> wrote:

>On 2004-10-20 09:35:20 +0200, "kiki" <lunaliu3@yahoo.com> said: > >> But what is the intuitive(phylosophical) thought behind this >> cross-correlation function? Why it reflects the similarity between the >> two functions f and g? > >Well, if you look closely you'll see that the (cross)correlation >process does something that can be seen as actually "comparing" one >data set with an inreasingly delayed version of another data set. If >you have a perfect match of the two sets for a given delay ("lag") you >get a peak in the correlation function. That's pretty intuitive >already, isn't it?
I'm just a beginner with DSP etc., so please excuse my ignorance. I've been reading chapter 7 of "The Scientist and Engineer's Guide to Digital Signal Processing", and its explanation of correlation makes sense to me, yet also seems to have "bugs", as it were. For example, with a signal bounded between -1 and 1, and values of around 0.3 in the target signal, won't the resulting cross-correlation signal always be highest in the areas where the original signal averages around its peak? i.e. 0.3*1 > 0.3*0.3, by far. Surely in that case the correlation signal is going to show higher correlation where there is none? What am I missing? Have I misunderstood the concept, or is it just that this method of correlation is a best-case method for general signals? Should it not be applied where the signal doesn't fluctuate rapidly? Would the practical solution be to use a larger sliding window in cases like these? Thank in advance for any help.
Oops, I made another mistake in my earlier post. I wish this newsgroup
has an "edit" function. Sorry for sending so many posts.

Here is the correction:

  (a-b)^2 >= 0  
=> a^2 + b^2 >= a*b + a*b
On Sat, 23 Oct 2004 18:27:05 -0700, Bob Cain
<arcane@arcanemethods.com> wrote:

> > >Kedi wrote: >> On 2nd thought, Bob, you are not "quite right". You are "absolutely >> right" in saying that I should have used the word "inner product" in >> all my previous posts. > >As I said, just a nit. The real content was illuminating >for me. One of the problems with being self taught is that >the lack of a disciplined course can result in a hit or miss >base of knowledge.
(snipped) Whew! You're not kiddin' !! But that's one of the great values of this news group. The guys here sure help us improve our aim. [-Rick-]