title: How to find distance matrix in matlab
body: <p>I am using <code>pdist2(x(i), y(j), 'euclidean')</code> formula to find euclidean distance between x and y instead of the manual method </p>
  
  <pre><code>sqrt((x(i)-y(i))^2).
  </code></pre>
  
  <p>And to find co relation coefficient I am using <code>corrcoeff( x(i), y(j))</code> . Is this the correct way to find correlation coefficient and euclidean distance between x and y matrix? 
  I get different answers when I use formula and manual method.</p>