Feel a bit sheepish about not being able to figure this out on my own.
I am playing with correlating known sequences/preambles in a wireless signal. If my template signal is a sinusoid, what would be autocorrelation output?
For real signals, (I think) I know that the auto-correlation of a sinusoid is a (sinusoidal) function of the time/phase difference of the sinusoid, which is intuitive i.e. when the received signal and the template are in phase, one would see a correlation peak, when they are completely out of phase, one would see the minimum correlation output, and so on.
For complex signals, does this also hold? I would think so, but my signal processing software (X-midas) is giving me a flat constant output when I slide the template signal over the received signal. I would have expected the output to be a sinusoid with peaks when the template is exactly aligned with the received signal, and not a flat/constant value.
Wanted to confirm I am not missing something basic before trying to figure out if the software routine is doing somethign wrong.
The absolute value of your correlation will always be 1, but the phase will change. Maybe your software just shows you the absolute value?
Yes - it shows the absolute value. Thanks.
I think the best way think about complex correlation is from a geometric viewpoint. If you represent each complex sinusoid as rotating phasor on the complex plane the correlation is represented as the orthogonal projection of one vector onto the other. So for phasors that are in phase the correlation would be +1 (positive correlation), for phasors that are 90 degrees out of phase the correlation would be 0 (uncorrelated) and for phasors that are 180 degrees out of phase the correlation would be -1 (negative correlation).
I was thinking along those lines too, but that doesn't line up with the constant correlation I get in software (and as said by dudelsound). I suppose for complex sinusoids no matter what the phase difference between the two waveforms being correlated, the correlation (magnitude) is always 1/constant.
Your software is behaving properly.
In auto-correlation, you are multiplying waveform #1 with itself, but shifted in time, and the magnitude of the auto-correlation output is the magnitude of the product of the two copies of the sine wave as a function of delay. When you are auto-correlating a complex sine wave, you are measuring the magnitude of the product of two phasors: phasor #1: magnitude M at angle phi, and phasor 2: magnitude M (the same M) at angle theta. The magnitude of the product of these two phasors is *CONSTANT*: SQR(M). As opposed to the case of auto-correlating a purely real sinusoid: In that case you are measuring the magnitude of the product of the first phasor (manitude M at an angle of 0, which means it's on the real axis) with the magnitude of the projection of the second phasor (magnitude M at an angle theta, corresponding to the delay) with the real axis. The reason is that the second sinusoid (which is really just a delayed version of the first) consists of two components: One that is in-phase with the first sinusoid, and one that is in quadrature with it. The in-phase component, which is the projection of the phasor with the real axis, bears a cos(theta) term. That is why you get the sinusoid in your auto-correlation for a purely real sine wave.
Thanks acheshir that helps. I realized that thinking in exponential notation also makes this obvious - I was trying to visualize the overlaying of sinusoids which is valid for the real case but not as intuitive for the complex case.