# Cross Correlation Definition

Started by July 16, 2007
```I have read about cross correlation in several places and I think I
understand it but there is this particular definition of correlation that
keeps me thinking.

In a probabilistic framework I have seen the cross correlation of an
stochastic process x(n) defined as:

Rxx = E{x(n)x'(n)}   where E denotes expectation operator and ' denotes
conjugate  transpose. (hermitian transpose)

This definition appears in papers that use matrix notation and is very
appealing for direct Matlab implementation. I implement it as mean(x*x')
for x being a random process with zero mean. (is this correct)

Now the definition I learned at school is:

Rx(t,tau) = E{x(t+tau/2)x(t-tau/2)}

Is this definition equivalent to the former one?? In the first definition
I fail to see if Rxx should be interpreted as Rxx(tau) as I see no lags on
it.

any clarifications on these two definitions would be greatly appreciated.

```
```On Jul 16, 7:52 am, "ryujin_ssdt" <hsan...@gmail.com> wrote:
> I have read about cross correlation in several places and I think I
> understand it but there is this particular definition of correlation that
> keeps me thinking.
>
> In a probabilistic framework I have seen the cross correlation of an
> stochastic process x(n) defined as:
>
> Rxx = E{x(n)x'(n)}   where E denotes expectation operator and ' denotes
> conjugate  transpose. (hermitian transpose)
>
> This definition appears in papers that use matrix notation and is very
> appealing for direct Matlab implementation. I implement it as mean(x*x')
> for x being a random process with zero mean. (is this correct)
>
> Now the definition I learned at school is:
>
> Rx(t,tau) = E{x(t+tau/2)x(t-tau/2)}
>
> Is this definition equivalent to the former one?? In the first definition
> I fail to see if Rxx should be interpreted as Rxx(tau) as I see no lags on
> it.
>
> any clarifications on these two definitions would be greatly appreciated.

You're really abusing the notation here.

process
is invariant in its correlation, i.e., it is wide-sense stationary.
code is an *estimate* of this quantity.

In what your learned at school, it does not assume wide-sense
stationary.
That's why you have t and tau.

Julius

```
```>On Jul 16, 7:52 am, "ryujin_ssdt" <hsan...@gmail.com> wrote:
>> I have read about cross correlation in several places and I think I
>> understand it but there is this particular definition of correlation
that
>> keeps me thinking.
>>
>> In a probabilistic framework I have seen the cross correlation of an
>> stochastic process x(n) defined as:
>>
>> Rxx = E{x(n)x'(n)}   where E denotes expectation operator and '
denotes
>> conjugate  transpose. (hermitian transpose)
>>
>> This definition appears in papers that use matrix notation and is very
>> appealing for direct Matlab implementation. I implement it as
mean(x*x')
>> for x being a random process with zero mean. (is this correct)
>>
>> Now the definition I learned at school is:
>>
>> Rx(t,tau) = E{x(t+tau/2)x(t-tau/2)}
>>
>> Is this definition equivalent to the former one?? In the first
definition
>> I fail to see if Rxx should be interpreted as Rxx(tau) as I see no lags
on
>> it.
>>
>> any clarifications on these two definitions would be greatly
appreciated.
>
>You're really abusing the notation here.
>
>process
>is invariant in its correlation, i.e., it is wide-sense stationary.
>code is an *estimate* of this quantity.
>
>In what your learned at school, it does not assume wide-sense
>stationary.
>That's why you have t and tau.
>
>Julius
>
>

So Rxx = E{x(n)x'(n)} assumes the process is wide-sense stationary and an
estimate of it can be obtained in matlab using Rxx = mean(x*x'). Then in
the case Rxx(t,tau) that does not assume wide-sense stationary what would
be a good estimator in matlab??
```
```On 30 Aug, 06:57, "ryujin_ssdt" <hsan...@gmail.com> wrote:
> >On Jul 16, 7:52 am, "ryujin_ssdt" <hsan...@gmail.com> wrote:
> >> I have read about cross correlation in several places and I think I
> >> understand it but there is this particular definition of correlation
> that
> >> keeps me thinking.
>
> >> In a probabilistic framework I have seen the cross correlation of an
> >> stochastic process x(n) defined as:
>
> >> Rxx = E{x(n)x'(n)}   where E denotes expectation operator and '
> denotes
> >> conjugate  transpose. (hermitian transpose)
>
> >> This definition appears in papers that use matrix notation and is very
> >> appealing for direct Matlab implementation. I implement it as
> mean(x*x')
> >> for x being a random process with zero mean. (is this correct)
>
> >> Now the definition I learned at school is:
>
> >> Rx(t,tau) = E{x(t+tau/2)x(t-tau/2)}
>
> >> Is this definition equivalent to the former one?? In the first
> definition
> >> I fail to see if Rxx should be interpreted as Rxx(tau) as I see no lags
> on
> >> it.
>
> >> any clarifications on these two definitions would be greatly
> appreciated.
>
> >You're really abusing the notation here.
>
> >process
> >is invariant in its correlation, i.e., it is wide-sense stationary.
> >code is an *estimate* of this quantity.
>
> >In what your learned at school, it does not assume wide-sense
> >stationary.
> >That's why you have t and tau.
>
> >Julius
>
> So Rxx = E{x(n)x'(n)} assumes the process is wide-sense stationary

It is based at least on the assumtion that x is stationary, I am
not sure one needs "wide sense stationary." I haven't looked
up those details for over 10 years and my memory fails me.

> and an
> estimate of it can be obtained in matlab using Rxx = mean(x*x'). Then in
> the case Rxx(t,tau) that does not assume wide-sense stationary what would
> be a good estimator in matlab??

Forget matlab. Rxx(t,tau) is the general correlation sequence
centered at x(t). No stationarity involved, not at all easy
to estimate with or without matlab.

Rune

```
```Probably the best you can do is to generate many instances of x. e.g.
if x is a vector of length 10, generate 1000 such vectors.
Then average them as you mention  =mean (X * X').
That should be close to ensemble averaging as expected by theory.

Your Rxx would be =E(X * X') and a toeplitz matrix.

The second definition is for non-WSS processes as mentioned by others.
I think even that can be used for modelling. But depends on how you
are getting/generating your input data X. Only difference is that RV
statistics vary with time. So time dependent statistics need to be
evaluated. In practice it is usually done by assuming some form of
short-time stationarity and doing updated estimation from time to
time.

Regards
Piyush

On Aug 30, 9:57 am, "ryujin_ssdt" <hsan...@gmail.com> wrote:
> >On Jul 16, 7:52 am, "ryujin_ssdt" <hsan...@gmail.com> wrote:
> >> I have read about cross correlation in several places and I think I
> >> understand it but there is this particular definition of correlation
> that
> >> keeps me thinking.
>
> >> In a probabilistic framework I have seen the cross correlation of an
> >> stochastic process x(n) defined as:
>
> >> Rxx = E{x(n)x'(n)}   where E denotes expectation operator and '
> denotes
> >> conjugate  transpose. (hermitian transpose)
>
> >> This definition appears in papers that use matrix notation and is very
> >> appealing for direct Matlab implementation. I implement it as
> mean(x*x')
> >> for x being a random process with zero mean. (is this correct)
>
> >> Now the definition I learned at school is:
>
> >> Rx(t,tau) = E{x(t+tau/2)x(t-tau/2)}
>
> >> Is this definition equivalent to the former one?? In the first
> definition
> >> I fail to see if Rxx should be interpreted as Rxx(tau) as I see no lags
> on
> >> it.
>
> >> any clarifications on these two definitions would be greatly
> appreciated.
>
> >You're really abusing the notation here.
>
> >process
> >is invariant in its correlation, i.e., it is wide-sense stationary.
> >code is an *estimate* of this quantity.
>
> >In what your learned at school, it does not assume wide-sense
> >stationary.
> >That's why you have t and tau.
>
> >Julius
>
> So Rxx = E{x(n)x'(n)} assumes the process is wide-sense stationary and an
> estimate of it can be obtained in matlab using Rxx = mean(x*x'). Then in
> the case Rxx(t,tau) that does not assume wide-sense stationary what would
> be a good estimator in matlab??

```