Find the values of a, b, c, and d so that the cubic polynomial y = ax3 + bx2 + cx + d provides the best fit to the following (x,y) pairs in the least squares sense: (-1, -7), (0, 4), (1, 9), (2, 2), (3, 6), (4, 16). Note that to check your answer you can plot the given points together with your cubic polynomial on the same graph, and check to see that all 6 points lie fairly close to the curve (as in the tutorial file). But note that the curve might not pass directly through any of the 6 points. here example In curve fitting, suppose that we want to find the parabola that provides a good fit to the following (x, y) pairs: (1,3), (2,5), (3,-1), (4,-6), (5,-9). It is not possible to find a parabola that passes through all 5 points. i.e., the corresponding system Ax = b has no solution: xi = [1:5]'; yi = [3 5 -1 -6 -9]'; A=[xi.^2 xi ones(5,1)]; b=yi; rref([A b]) x=A\b f = @(t) x(1)*t.^2+x(2).*t+x(3); t = 0.5:.01:5.5; y = f(t); plot(t,y,xi,yi,'o','MarkerSize',5,'MarkerFaceColor','black') |