Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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_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 usingStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started