title: Matlab - linear regression - y-intercept by adding one column of ones
body: <p>I try to understand on the following link <a href="http://fr.mathworks.com/help/matlab/data_analysis/linear-regression.html" rel="nofollow">linear regression</a> the computing of coefficients beta0 and beta1 for the relation y = beta0 + beta1 x.</p>
  
  <p>I understand the first computing of beta1 which is actually a simple least-squares regression, but with only one paramater to find (the slope coefficient) ?</p>
  
  <p>In the example of "accidents", Why do they append a colum of ones to x array to compute the 2 coefficients :</p>
  
  <pre><code>X = [ones(length(x),1) x];
  b = X\y
  </code></pre>
  
  <p>result :</p>
  
  <pre><code>b =
  
     1.0e+02 *
  
     1.427120171726537
     0.000001256394274
  </code></pre>
  
  <p>what is the underlying calculation with this column of ones ?</p>
  
  <p>If anyone could explain to me.</p>