title: Ellipse around the data in MATLAB
body: <p>I would like to reproduce the following figure in MATLAB:</p>
  
  <p><img src="https://i.stack.imgur.com/4tegY.png" alt="exampleee.png"></p>
  
  <p>There are two classes of points with X and Y coordinates. I'd like to surround each class with an ellipse with one parameter of standard deviation, which determine how far the ellipse will go along the axis. </p>
  
  <p>The figure was created with another software and I don't exactly understand how it calculates the ellipse.</p>
  
  <p>Here is the data I'm using for this figure. The 1st column is class, 2nd - X, 3rd - Y. I can use <code>gscatter</code> to draw the points itself.</p>
  
  <pre><code>A = [
      0   0.89287 1.54987
      0   0.69933 1.81970
      0   0.84022 1.28598
      0   0.79523 1.16012
      0   0.61266 1.12835
      0   0.39950 0.37942
      0   0.54807 1.66173
      0   0.50882 1.43175
      0   0.68840 1.58589
      0   0.59572 1.29311
      1   1.00787 1.09905
      1   1.23724 0.98834
      1   1.02175 0.67245
      1   0.88458 0.36003
      1   0.66582 1.22097
      1   1.24408 0.59735
      1   1.03421 0.88595
      1   1.66279 0.84183
  ];
  
  gscatter(A(:,2),A(:,3),A(:,1))
  </code></pre>
  
  <p>FYI, <a href="https://stackoverflow.com/questions/2153768/matlab-to-draw-ellipse-and-ellipsoid">here</a> is the SO question on how to draw ellipse. So, we just need to know all the parameters to draw it. </p>
  
  <hr>
  
  <p><strong>Update:</strong></p>
  
  <p>I agree that the center can be calculated as the means of X and Y coordinates. Probably I have to use principal component analysis (<code>PRINCOMP</code>) for each class to determine the angle and shape. Still thinking...</p>