title: Cross-Correlation of two signals
body: <p>I want to find the correlation between two signals x1 and x2.</p>
  
  <pre><code>x1 = [1 1 1 1 1]
  x2 = [1 1 1 1 1]
  r1 = xcorr(x1,x2) //function in matlab to find cross correlation of x1 and x2
  </code></pre>
  
  <p>x1 and x2 both look like this 
      <img src="https://i.imgur.com/goN6ZZZ.jpg" alt="x1 or x2"></p>
  
  <p>and their cross correlation look like this
      <img src="https://i.imgur.com/qvBEVnD.jpg" alt="r1"></p>
  
  <p>I understand that correlation measures the degree of similarity between two signals, giving highest value to the point which corresponds to maximum similarity (the two signals are shifted relative to each other to measure similarity at different points right?). So in that case, the cross correlation should give a high value at all points but this is not so. The maximum value is at 5th position. Why is that? Can someone explain this to me?</p>