Answered step by step
Verified Expert Solution
Question
1 Approved Answer
f(x)=1+x21 Consider a data set of n equidistant points on the graph of f(x) on the interval [5,5]. That is, {(x1,f(x1)),(x2,f(x2)),,(xn,f(xn))} with x1=5 and xn=5.
f(x)=1+x21 Consider a data set of n equidistant points on the graph of f(x) on the interval [5,5]. That is, {(x1,f(x1)),(x2,f(x2)),,(xn,f(xn))} with x1=5 and xn=5. Write a MATLAB function y= newton_interp (n,x) that computes the value(s) of the Newton interpolating polynomial p(x) for this data at x(x can be a scalar or a vector), where n is the number of data points. (Refer to the algorithm at the bottom of page 331.) (b) Let x=5:1/30:5 and write a program to call the function newton_interp (n,x) with n=5,10, and 15 and plot the graphs of three interpolating polynomials and the exact function on the same figure. You may find hold on function useful to plot multiple graphs in the same figure. Add the legends to the figure. (c) Discuss your observation on the error behaviors depending on the number of data points. f(x)=1+x21 Consider a data set of n equidistant points on the graph of f(x) on the interval [5,5]. That is, {(x1,f(x1)),(x2,f(x2)),,(xn,f(xn))} with x1=5 and xn=5. Write a MATLAB function y= newton_interp (n,x) that computes the value(s) of the Newton interpolating polynomial p(x) for this data at x(x can be a scalar or a vector), where n is the number of data points. (Refer to the algorithm at the bottom of page 331.) (b) Let x=5:1/30:5 and write a program to call the function newton_interp (n,x) with n=5,10, and 15 and plot the graphs of three interpolating polynomials and the exact function on the same figure. You may find hold on function useful to plot multiple graphs in the same figure. Add the legends to the figure. (c) Discuss your observation on the error behaviors depending on the number of data points
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