Write a MATLAB function which takes as input two collections
Write a MATLAB function which takes as input two collections x1, x1, . . . , xn and y1, y1, . . . , yn of real numbers as well as a real number x and returns the value of the polynomial p(x) of degree n -1 such that p(xj ) = yj for all j = 1, 2, . . . , n at the point x. Compute the value of p(x) using the Lagrange formula.
Solution
Write a MATLAB function which takes as input two collections x1, x1, . . . , xn and y1, y1, . . . , yn of real numbers as well as a real number x and returns the value of the polynomial p(x) of degree n -1 such that p(xj ) = yj for all j
