# Correlation

Started by March 14, 2008
```I have 2 complex signals I need to find the time delay between them. Do I
use the amplitude of each in cross-correlation or I use the
cross-correlation of the complex signals. What are the advantages and

Regards

Tom

```
```On Mar 14, 2:25 pm, "Tom" <tomda...@yahoo.com> wrote:
> I have 2 complex signals I need to find the time delay between them. Do I
> use the amplitude of each in cross-correlation or I use the
> cross-correlation of the complex signals. What are the advantages and
>
> Regards
>
> Tom

You look at the magnitude of the complex cross correlation. To see
why, imagine that your signals are complex PN sequences or FM chirps.
In either case, the magnitude is 1 at all times, so the correlation of
the magnitudes won't tell you anything.

John
```
```>On Mar 14, 2:25 pm, "Tom" <tomda...@yahoo.com> wrote:
>> I have 2 complex signals I need to find the time delay between them. Do
I
>> use the amplitude of each in cross-correlation or I use the
>> cross-correlation of the complex signals. What are the advantages and
>>
>> Regards
>>
>> Tom
>
>You look at the magnitude of the complex cross correlation. To see
>why, imagine that your signals are complex PN sequences or FM chirps.
>In either case, the magnitude is 1 at all times, so the correlation of
>the magnitudes won't tell you anything.
>
>John
>

Hi John,

Mmmh ... I asked the same question in another context in another thread.
You say you should look at the magnitude?
Then you say the magnitude doesn't tell you anything.
So what exactly does the phase-information bring into the complex
cross-correlation?
I am very interested to understand correlation with complex signals.

gr.
Bjoern
```
```On Mar 15, 6:26&#2013266080;am, "banton" <bant...@web.de> wrote:
> >On Mar 14, 2:25 pm, "Tom" <tomda...@yahoo.com> wrote:
> >> I have 2 complex signals I need to find the time delay between them. Do
> I
> >> use the amplitude of each in cross-correlation or I use the
> >> cross-correlation of the complex signals. What are the advantages and
>
> >> Regards
>
> >> Tom
>
> >You look at the magnitude of the complex cross correlation. To see
> >why, imagine that your signals are complex PN sequences or FM chirps.
> >In either case, the magnitude is 1 at all times, so the correlation of
> >the magnitudes won't tell you anything.
>
> >John
>
> Hi John,
>
> Mmmh ... I asked the same question in another context in another thread.
> You say you should look at the magnitude?
> Then you say the magnitude doesn't tell you anything.
> So what exactly does the phase-information bring into the complex
> cross-correlation?
> I am very interested to understand correlation with complex signals.

The basic idea is the same as the vector calculus you probably
are familiar with from high school, or tehereabouts. Below I
indicate how correlation fits into the big picture, by recap'ing
some basic geometric concepts in 2D and then extending to ND.
Then I indicate how to deal with complex data.

In 2D vectors are represented as two numbers,

xv = [x1,x2]'
yv = [y1,y2]'

where xv' means 'xv transposed'. You can measure how the
vector v1 relates to vector v2 by measuring the inner product cxy

cxy = xv'*yv = x1*y1+x2*y2                               

and go on analyzing the details by normalizing by magnitudes,
finding angles and so on. And in high school (or thereabouts)
one do the same analysis in 3D.

Now to DSP. The concept of a 'vector' as we know it from the
high school (or thereabouts) 2D and 3D analyses, can conceptually
be extended to 4 and more dimensions. The maths work exactly
the same and the principles are exactly the same; the only
difference is that the human mind can't develop a clear intuition
in more than 3D.

So if you modify the vectors xv and yv above to

xv = [x1, x2, ..., xN]'
yv = [y1, y2, ..., yN]'

and adjust the formula  accordingly,

cxy = x1*y1 + x2*y2 + ... + xN*yN             

one can see that the only difference between  and 
is the number of terms involved. If you set N=3 you have
the inner product which is so familar from 3D geometry.
With N=4 and more, your intuituion fails but the concepts
still apply.

OK, what about complex-valued data. The inner products
with complex-valued vectors are defined as

cxy = xv"yv

where xv" means 'xv transposed and complex conjugated'.

So correlation of N-length sequences is a very simple
concept. The main problem is to become confident with
vector spaces with more than 3 dimensions. If you manage
to develop that kind of concept, the rest is trivial.

Handling complex numbers is merely a matter of adjusting
computational details; the main concepts from N-D vector
spaces still apply.

Rune
```
```On Mar 15, 1:26 am, "banton" <bant...@web.de> wrote:
> >On Mar 14, 2:25 pm, "Tom" <tomda...@yahoo.com> wrote:
> >> I have 2 complex signals I need to find the time delay between them. Do
> I
> >> use the amplitude of each in cross-correlation or I use the
> >> cross-correlation of the complex signals. What are the advantages and
>
> >> Regards
>
> >> Tom
>
> >You look at the magnitude of the complex cross correlation. To see
> >why, imagine that your signals are complex PN sequences or FM chirps.
> >In either case, the magnitude is 1 at all times, so the correlation of
> >the magnitudes won't tell you anything.
>
> >John
>
> Hi John,
>
> Mmmh ... I asked the same question in another context in another thread.
> You say you should look at the magnitude?
> Then you say the magnitude doesn't tell you anything.
> So what exactly does the phase-information bring into the complex
> cross-correlation?
> I am very interested to understand correlation with complex signals.
>
> gr.
> Bjoern

I said don't cross-correlate the magnitudes.

Here is a description from Wikipedia:

http://en.wikipedia.org/wiki/Cross-correlation

John
```
```Rune Allnor wrote:
>[snip]
>
> In 2D vectors are represented as two numbers,
>
> xv = [x1,x2]'
> yv = [y1,y2]'
>
> where xv' means 'xv transposed'. ...

and later generalized to

>
> xv = [x1, x2, ..., xN]'
> yv = [y1, y2, ..., yN]'
>

I take your notation as explicitly saying that you are considering xv
and yv to be column vectors. Why not row vectors? I don't see how it
would change any of your results (other than notation)

inner product of xv and yv would be xv*yv' rather than xv'*yv .

```
```On Mar 15, 12:40&#2013266080;pm, Richard Owlett <rowl...@atlascomm.net> wrote:
> Rune Allnor wrote:
> >[snip]
>
> > In 2D vectors are represented as two numbers,
>
> > xv = [x1,x2]'
> > yv = [y1,y2]'
>
> > where xv' means 'xv transposed'. ...
>
> and later generalized to
>
>
>
> > xv = [x1, x2, ..., xN]'
> > yv = [y1, y2, ..., yN]'
>
> I take your notation as explicitly saying that you are considering xv
> and yv to be column vectors. Why not row vectors? I don't see how it
> would change any of your results (other than notation)
>
> inner product of xv and yv would be xv*yv' rather than xv'*yv .

You need to specify oe of them. In the texts I know of which
deal with DSP in terms of linear algebra, the convention is that
vectors are column vectors.

Rune
```
```Rune Allnor wrote:
> On Mar 15, 12:40 pm, Richard Owlett <rowl...@atlascomm.net> wrote:
>
>>Rune Allnor wrote:
>>
>>>[snip]
>>
>>>In 2D vectors are represented as two numbers,
>>
>>>xv = [x1,x2]'
>>>yv = [y1,y2]'
>>
>>>where xv' means 'xv transposed'. ...
>>
>>and later generalized to
>>
>>
>>
>>
>>>xv = [x1, x2, ..., xN]'
>>>yv = [y1, y2, ..., yN]'
>>
>>I take your notation as explicitly saying that you are considering xv
>>and yv to be column vectors. Why not row vectors? I don't see how it
>>would change any of your results (other than notation)
>>
>>inner product of xv and yv would be xv*yv' rather than xv'*yv .
>
>
> You need to specify oe of them. In the texts I know of which
> deal with DSP in terms of linear algebra, the convention is that
> vectors are column vectors.
>
> Rune

OK Thanks. DSP hadn't been invented when I took my last formal math in
mid 60's.

```