Question: 1. Program a function, polyFit (x, f), that implements a polynomial curve fitting algorithm. The function takes as the first argument an (n + 1)-dimentional

 1. Program a function, polyFit (x, f), that implements a polynomial

1. Program a function, polyFit (x, f), that implements a polynomial curve fitting algorithm. The function takes as the first argument an (n + 1)-dimentional vector of points, x, and as the second argument, f, an (n + 1)-dimensional vector of the values of the function f at those points. The function should return a vector ((n + 1)-dimensional) which holds the coefficients of the resulting interpolating polynomial of order n, in the increasing order. That is, the first entry of the output is the coefficient of ro, the second entry is the coefficient of a , and so on. (The (n + 1)-th entry of the output will be the coefficient of a" of the interpolating polynomial.) You may choose any method of your choice to find the interpolating polynomial, however, note that if you choose a method such as Newton's divided polynomials, you will need a post processing to put a polynomial of the form f(x) ~ bo + bi(x - To) + 62(x - xo)(x - 21) + . .. + bn-1(x - x0)(x - 21) . .. (x - In-2), into the form f(x) ~ do + aix + aziz + ... + an-127-1, which is requested by the statement of the problem. 2. Develop a plot of the following data with (a) a sixth-order interpolating polynomial, (b) a cubic spline. 100 200 400 600 800 1000 f(x) 0 0.82436 1.00000 0.73576 0.40601 0.19915 0.09158 You may use your function from the previous problem for part (a) and interpl from Octave/MATLAB for part (b). Include in your plot a graph of the function f(x) = 200 1-x/200 which was used to generate these data. Is there any preference in using interpolating polynomials or a cubic spline in this case

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!