Question: This is the polyinterp code: function v = polyinterp(x,y,u) tic n = length (x); v = zeros(size(u)); for k = 1:n w = ones(size(u)); for
This is the polyinterp code: function v = polyinterp(x,y,u) tic n = length (x); v = zeros(size(u)); for k = 1:n w = ones(size(u)); for j = [1:k-1 k+1:n] w = (u-x(j))./(x(k)-x(j)).*w; end v = v + w*y(k); toc end

a) Write a MATLAB code that performs polynomial interpolation using the Vandermonde matrix. Your code should not use the built in vander command, you should also not use inv or the backslash operator to solve the linear system, i.e. use LU factorization and substitution. Compare the time it takes to run your code to the time to run polyinterp.m. Is this what you expect/can you explain the time difference. b) Use the code you wrote in part (a) to interpolate the data points; x=1000:1:1100y=(x10001)(x1000.12)(x1000.13) Plot this interpolation and the one found by using the built in function polyinterp.m. Explain why they are different
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
