title: Distance Between Two Points in Matlab
body: <p>I have 2 vectors one is 200*2 in dimension and other is 3*2.All of them are points in a cartesian coordinate system. I want to calculate the distance between the first 200 and  the other 3 points and store them in a vector. I'm using a function like this;</p>
  
  <pre><code>for i=1:cur
      for j=1:200
          L(j,i)=sqrt(square(P2(i,1)-C(j,1))+square(P2(i,2)-C(j,2)))
      end
  end
  </code></pre>
  
  <p>where cur is 3 , P2 being the 3*2 vector and C being the 200*2.Now the results i get are completely wrong but I cannot figure out the problem in that. Any help would be good , if there is another way to compute it i would appreciate.By the way for more information ;</p>
  
  <pre><code>P2 = [2 -2;3 -5 ; -1 3];
  </code></pre>
  
  <p>and the other is</p>
  
  <pre><code>theta = linspace(0,2*pi,200)';   %'
  unitCircle = [cos(theta) sin(theta)];
  C = zeros(numel(theta),2,num);
  </code></pre>