Question: I NEED HELP WITH BOTH 1. Write a MATLAB function, called Lagrange_poly that inputs a set of data points (x,y)=(datx, daty), a set r of

I NEED HELP WITH BOTH 1. Write a MATLAB function, called Lagrange_polythat inputs a set of data points (x,y)=(datx, daty), a set rI NEED HELP WITH BOTH

1. Write a MATLAB function, called Lagrange_poly that inputs a set of data points (x,y)=(datx, daty), a set r of numbers at which to interpolate, and outputs the polynomial interpolant, y, evaluated at x using Lagrange polynomial interpolation. Your function header should look something like: function y Lagrange-poly(x, datx, daty) = (a) Use the code you developed to interpolate the functions i, fi(z) = e-z? ii, f2(x) using the datapoints datx= 3:1:3. Interpolate at the points-3:0.01 :3 Call Pi thea- grange interpolant of f, and P2 the Lagrange interpolant of f2. Repeat the experiment except using the data datxl--3:0.5:3. Call in that case P3 and P4 the new interpolants. Compare your answer for this problem to what you got previously. For each interpolation problem, plot on the same graph the function, the two interpolants, and the data set (use the function scatter). Comment the results in your matlab script using

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 Databases Questions!