Exercise "Least-squares fit"

  1. Make a function/subroutine 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/subroutine must return the vector of coefficients and the covariance matrix.
  2. Make a linear fit to the following data
    xi = i+1/2, yi = i + cos(2i), σi = 1+sin2(2i), i=0..10
  3. Make some other interesting fits.