Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Wikipedia gives the cross-correlation as

$$ \begin{align*} (f \star g)[n] = \sum^{\infty}_{m = -\infty} f^{*}[m] g[n+m] \end{align*} $$

MATLAB's documentation gives xcorr(x, y) as

$$ \begin{align*} R_{xy}[n] = E(x[n+m]y^{*}[m]) \end{align*} $$ where $E$ is the evaluation function and I have switched $m$ and $n$ so it's consistent with Wikipedia's notation.

They're obviously opposite with respect to one another. If Wikipedia's definition is correct, why did MATLAB implement their function to be the opposite of the mathematical definition?

Am I missing something here? Because this difference just caused me a lot of pain while working on a project.

share|improve this question
    
Aren't these just the complex conjugates of each other? –  nbubis Apr 29 '12 at 5:22
    
Can you explain further? How are they complex conjugates? –  xiongtx Apr 29 '12 at 6:13
    
Well, If understood you correctly, the only difference is: $$(f \star g)_{matlab}$$ = $$(g \star f)_{wiki}$$ –  nbubis Apr 29 '12 at 7:56
    
Yes, which tripped me up for a while. Just wondering if this is just an annoying "feature", or am I missing out on some critical reason for MATLAB's method of implementation. –  xiongtx Apr 29 '12 at 8:23
add comment

1 Answer

It's just a matter of notation - similar to the definition of the Fourier Series (does one include $2\pi$ ? ). All properties of the cross correlation stay the same.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.