Question: 3. Write a computer program for a Lagrange interpolator given n data points that may or may not be uniformly spaced. (a) Test your interpolation

3. Write a computer program for a Lagrange interpolator given n data points that may or may not be uniformly spaced. (a) Test your interpolation for data points obtained from sampling known functions. How well does your interpolant reproduce the expected behavior of the function? Where are errors the greatest? What happens as n increases? (b) Apply your code to the Runge function f(x) = (1+ 25x2)-1 sampled at n uniformly spaced points between -1 and 1 (see Moin Example 1.1). Discuss your results as n increases. (c) Repeat (b) but with points spaced closer together near the boundaries and farther apart in the middle of the domain (see Moin Example 1.2). Hint: One way to pick points clustered this way is to use the cosine of a uniformly spaced angle. (d) Repeat (a-c) but with cubic spline interpolation. You may use built-in functions for spline interpolation. (e) (open ended) Explore/review other interpolation options in MATLAB
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
