Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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))
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Concepts, Theories, And Applications

Authors: Shui Yu, Song Guo

1st Edition

3319277634, 9783319277639

More Books

Students also viewed these Databases questions