title: How do I use the least squares approximation in MATLAB?
body: <p>For a homework assignment in linear algebra, I have solved the following equation using MATLAB's <code>\</code> operator (which is the recommended way of doing it):</p>
  
  <pre>
  A = [0.2 0.25; 0.4 0.5; 0.4 0.25];
  y = [0.9 1.7 1.2]';
  x = A \ y
  </pre>
  
  <p>which produces the following answer:</p>
  
  <pre>
  x =
  1.7000
  2.0800
  </pre>
  
  <p>For the next part of assignment, I'm supposed to solve the same equation using the least squares approximation (and then compare it against the prior value to see how accurate the approximation is).</p>
  
  <p>How can I find a way of doing that in MATLAB?</p>
  
  <p>Prior work: I have found the function <code>lsqlin</code>, which seems to be able to solve equations of the above type, but I don't understand which arguments to supply it nor in what order.</p>