Problem #1: Open up your 'my_script.m' file that you created while working through Tutorial 2. Then copy and paste the 9 commands from the curve fitting example in Section 2.2 into your script file (you can delete any other commands that are in the file). Then save and execute your script file and make sure that the output produced (including the graph) agrees with the ouptut in the tutorial file. You should not proceed with the below question until this has been done correctly.
By modifying the appropriate lines in your script file, find the values of a, b, c, and d so that the cubic polynomial $y = ax^3 + bx^2 + cx + d$ passes through the (x, y) pairs (0,4), (1,9), (2, 2), and (3,6).
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 4 points lie on the curve (as in the tutorial file). Note that you will likely have to modify the t vector so that it corresponds with the range of x-values above.
separate your answers with a comma
Problem #2: Find the values of a, b, c, and d so that the cubic polynomial $y = ax^3 + bx^2 + 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.
separate your answers with a comma