title: Plot Representative sample of large data set - Matlab
body: <p>I have a large data set with two arrays, say <code>x</code> and <code>y</code>. The arrays have over 1 million data points in size. Is there a simple way to do a scatter plot of only 2000 of these points but have it be representative of the entire set? </p>
  
  <p>I'm thinking along the lines of creating another array r ; <code>r = max(x)*rand(2000,1)</code> to get a random sample of the x array. Is there a way to then find where a value in <code>r</code> is equal to, or close to a value in <code>x</code> ? They wouldn't have to be in the same indexed location but just throughout the whole matrix. We could then plot the <code>y</code> values associated with those found <code>x</code> values against <code>r</code> </p>
  
  <p>I'm just not sure how to code this. Is there a better way than doing this? </p>