1. a. Interpolate the function sin(x) at 5 Chebyshev points (using both Chebyshe
ID: 3841351 • Letter: 1
Question
1. a. Interpolate the function sin(x) at 5 Chebyshev points (using both Chebyshev-Gauss-Lobatto, and
Chebyshev-Gauss) over the interval [0; pi/2]. Compare your results to those you obtained in Homework 5
(using equispaced nodes).
b. Repeat (interpolate sin(x)), but this time use 5 Chebyshev points (using both Chebyshev-Gauss-Lobatto,
and Chebyshev-Gauss) over the interval [0;pi ]. What can you say?
2. Interpolate the Runge function
1/(1 + 25x^2) on the interval [-1; 1] using 10, 15, 20, and 25 equidistant points
and 10, 15, 20, and 25 Chebyshev points (using both Chebyshev-Gauss-Lobatto, and Chebyshev-Gauss).
Graph the interpolants.
Please provide only Matlab Code
Explanation / Answer
Please post as separate questions:
2) Equally 11 spaced points of step size 1/5 and at the Chebyshev nodes.
>> f = @(x) (1./(1+25*x.^2));
>> xn=-1:.2:1; #Change step size here to change number of points between -1 and 1
>> yn=f(xn);
>> x=-1:.001:1;z=f(x);
>> plot(x,z,xn,yn,’o’)
The Interpolating polynomials plotted against the graph of f(x)
>> If=int_poly(yn,xn,x);
>> plot(x,z,x,If)
>> i=0:10;cn=cos(((2*i+1)./(22))*pi);
>> fcn=f(cn); >> Ifcn=int_poly(fcn,cn,x);
>> plot(x,z,x,Ifcn)
>> max(abs(z-Ifcn))
HOPE IT HELPS!
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.