Exercise "Least-squares fit"

  1. Make a function that fits a given data-set [xi, yi, σi], i=1..n, with a linear combination of given functions [fk(x)], k=1..m. The function must return the vector of coefficients and the covariance matrix.
  2. Make a linear fit to e.g. the following data (or any other data)
    xi = i+1/2, yi = i + cos(2i), σi = 1+sin2(2i), i=0..10
  3. Make some other interesting fits, e.g. investigate how reasonable the errors on the fitting coefficients are.