# cross correlation

Started by January 20, 2006
```Hello Everybody,
i am a newcomer to dsp as well as this usenet.
i was studying cross correlation using matlab, the two signals which i
used were a 1 hz sine and a 2 hz sine, the waves were sampled at 10hz, i
got 2 correlation peaks one at 8th  bin and other at 14th , why there are
two peaks?, is it that if we get more than one peak, the correlation
result cannot be accepted as the above two signals were totally
different?

Regards,
Satyajeet

```
```"satyajeet" <satyajeet_vb@yahoo.com> wrote in message
news:CaGdna9b6t0Hm0zenZ2dnUVZ_tudnZ2d@giganews.com...
> Hello Everybody,
>  i am a newcomer to dsp as well as this usenet.
> i was studying cross correlation using matlab, the two signals which i
> used were a 1 hz sine and a 2 hz sine, the waves were sampled at 10hz, i
> got 2 correlation peaks one at 8th  bin and other at 14th , why there are
> two peaks?, is it that if we get more than one peak, the correlation
> result cannot be accepted as the above two signals were totally
> different?

Hi  Satyajeet,
It's that sin(x) and sin(2x) , far from being totally different are very
very similar, you can check this yourself by plotting several cycles of each
in the same graph.  They are symmetric and orthogonal to each other over any
integer multiple of either period so you can expect your cross correlation
reults to drop to near zero for any lag which is an integer multiple of
your shortest period ( bins 11, 21 etc. in your example because matlab puts
zeroth lag in bin 1 (no bin 0) ).  Try sampling at 16 Hz and see if you get
proper zeros .  For other lags the signals are not orthogonal they are
either predominantly in-phase or in antiphase so the covariance vector has
both a positive and a negative peak and after squaring you will see two
positive peaks.

Best of luck - Mike

```