CS 3414 Homework 3
Due 5:00 p.m., June 12, 2002

The following problems are all based on Problem Statement 3 and the data described there. You will also want to study the Matlab code available here; the file example.m is a generic example of how to do least squares curve fitting in Matlab.

  1. Find the straight line that fits the data best in the least squares sense. Report the function itself and the 2-norm of the residual vector. Also make two plots showing: (1) the original data and the approximating line, and (2) the scaled residuals.

  2. Based on the results from the previous problem, identify one of the data points that you think should be thrown out. Then repeat the previous problem with that point removed.

  3. Now repeat the previous problem (i.e., leaving the one bad point out) but with 3 basis functions: b1(x) = 1, b2(x) = x, b3(x) = sin(x).

  4. In some situations, not all data points should be treated equally. For instance, suppose you want your approximating function F(x) to essentially interpolate the first and last data points, e.g., perhaps you trust those values more, or you know for other reasons that your approximation must pass directly through those points. A simple way to cause this to happen is to weigh more heavily those equations in the overdetermined linear system. In this way, the solution that minimizes the squares of the residuals will be sure to make those residuals much closer to zero than the the residuals corresponding to the other points.

    Repeat the previous problem, but with the 1st and last equation in the overdetermined linear system A*alpha = y scaled by a factor of 10.