Question: Interpolation ( a ) Please implement functions p = ninterp ( n o d e v a l s , fvals ) y = polyeval

Interpolation
(a) Please implement functions
p= ninterp(nodevals, fvals)
y=polyeval(p,x, nodevals)
where nodevals is the vector containing the interpolation nodes, fvals is the
vector containing function values at the nodes, and p is a vector of Newton poly-
nomial coefficients and polyeval evaluates the Newton polynomial via Horner's
method to a whole list of points in the vector x.
(b) Now use your ninterp function to interpolate the two functions
h1(x)=e-x+sinx
h2(x)=11+t2
on the interval -5,5 for n=4,8,12, and 16 equidistant points. Plot both
interpolation polynomials with the functions they interpolate. Explain what you
see
Aside: If you want to declare a function which takes only one argument and
evaluates your specific Newton polynomial at any point to use when you plot,
you can do so in-line as follows.
poly =@(x)polyeval(p,x, nodevals )
x=linspace(-5,5,1000);
plot(x,poly(x))
 Interpolation (a) Please implement functions p= ninterp(nodevals, fvals) y=polyeval(p,x, nodevals) where

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!