Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Goal: Interpolate the function f(x) = 1/(x^2 + 1) on the interval [-5, 5] using

ID: 1720223 • Letter: G

Question

Goal: Interpolate the function f(x) = 1/(x^2 + 1) on the interval [-5, 5] using Chebyshev nodes. Use different numbers of nodes, say, n = 5, 10, 20, 30. Plot the resulting polynomials together. Answer the question: do they appeal to converge to the function f? Method: Use the New ton interpolating method from earlier homework. In particular, the functions "coeff" and "newton" can be reused here. Add a new function "chebyshev" that takes 4 parameters: endpoints of the interval a, b, the number of nodes to use n, and a vector t on which the interpolating polynomial is to be evaluated. To plot different polynomials so that they ate given different colors. You may put all of them into a matrix (one row per polynomial), and then pass them all to be plotted. For example, the main function could define a, b, t and execute

Explanation / Answer

>> f = @(x) 1./(1+x.^2);

>> n = 5; %n=10,15,20,..etc as well

>> xe = linspace(-1,1,n);

>> xc = cos((2*(1:n)-1)*pi/2/n);

>> t = -5:.01:5;

>> plot(t,f(t),'b',t,neville(xe,f(xe),t),'r',xe,f(xe),’o’)

>> plot(t,f(t),'b',t,neville(xc,f(xc),t),'r',xc,f(xc),’o’)

The function can be seen to be coverging after plotting the graphs.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote