Question
For Runges function f(x) = 1/(1+25x2 ) on the interval [1,1] write a MATLAB program that interpolates the function with polynomials p(x) of order 5,
For Runges function f(x) = 1/(1+25x2 ) on the interval [1,1] write a MATLAB program that interpolates the function with polynomials p(x) of order 5, 10, 20 and 40 using
a) Equally spaced nodes with x 0 =1, and x n =1 for n = (5, 10, 20 and 40).
b) Nodes defined by cos(i/n) for 0in and n = (5, 10, 20 and 40).
c) The Chebyshev nodes cos((2i+1)/(2n+2)) with 0in and n = (5, 10, 20 and 40)
Use Newtons formulation of the interpolating polynomial.
For each of a), b) and c) compute the coefficients in the polynomial for each set of nodes (12 cases total) by Divided Differences based on the pseudocode on slide 20, Lecture 8 (or the book page 166).
Evaluate f(x) and p(x) at 200 equally spaced x values with x1=1 and x200=1 for a), b) and c) for each set of nodes based on the pseudocode on slide 22, Lecture 8 (or the book page 166) and plot the error f(x)p(x).
Make three plots, one for a) one for b) and one for c) with each plot including plots of the error for the four sets of nodes.
What is the maximum positive error for each case?
What is the maximum negative error for each case?
What is the square root of the mean square error for each case? (sqrt(1 200(f(xi)p(xi))2 /200))
Compare and discuss the results.
Step 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