79502042

Date: 2025-03-11 20:31:57
Score: 1.5
Natty:
Report link

The fact that you don't get corr=1 at the expected location is because the normalization in Mathlab (and possibly also in other packages) is not performed correctly. A cross correlation is in fact a "sliding dot product" between the two data arrays. To get -1<=corr<=1 one can get the cos(theta) related to the dot product, which means that for each window one has to normalize the unnormalized corr by dividing by the product of the two vector lengths that is currently in use.

You can find the correct formula in eq. (1) of the following article

https://pmc.ncbi.nlm.nih.gov/articles/PMC4123965/#:~:text=A%20relatively%20efficient%20way%20of,sums%20of%20the%20squared%20signal)

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: Nick van Eijndhoven