Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Consider the problem of approximating the function f(x) = 1/(1 + 25x^2) on theinterval [1,1] with the least squares approximation Cn(x) based on Chebyshev

1. Consider the problem of approximating the function f(x) = 1/(1 + 25x^2) on theinterval [1,1] with the least squares approximation Cn(x) based on Chebyshev polynomials.

a) Write a Matlab function polycheb that evaluates a Chebyshev polynomial Tn(x) of a given degreenat given points x[1,1]. Plot the Chebyshev polynomialsTn(x),n= 0,1,2,3,4 and 5. Hint: Use the triple recursion formula given in class.

b) Compute the coefficients in the least squares approximation, cj=(2/) f(x)Tj(x)/[1x^2]dx, j= 0,1,2,...,n bounded from -1 to 1. Hint: Use the gausscheb function to compute the integrals.

c) Write a function eval_C that evaluates the least squares approximation based on Chebyshev polynomials Tn(x) at a given vector x. Compute Cn(x) =(1/2) c0T0(x) +nj=1 cjTj(x), n= 2,4,6,8. Plot bothf(x) and Cn(x) in one plot and the error f(x)Cn(x) in another, for each n.This polynomials should provide progresively better approximation as ngrows.

d) Use the built in Matlab function polyfit with the n+ 1 nodes chosenequidistant in [1,1] to build an interpolating polynomial Pn(x) of degree n using n+ 1 equidistant nodes. Compute Pn(x), for n= 2,4,6,8. Plot both f(x) and Pn(x) in one plot and the error f(x)Pn(x) in another, for each n. Do these polynomials provide progresively better approximation as n grows?

e) Use the built in Matlab function polyfit to build an interpolating polynomial In(x) based on Chebyshev nodes given by xj = cos[(2j+ 1/2n+ 2)], j= 0,1,...,n. Compute In(x), for n= 2,4,6,8. Plot both f(x) and In(x) in one plot and the error f(x) In(x) in another, for each n. Do these polynomials provide progresively better approximation as n grows?

f) Finally, compare all three polynomials Pn(x), In(x), and Cn(x) in approximating f(x) when using for instance n= 8 and n= 16 for all of them. That is plot f(x),Pn(x), In(x), and Cn(x) (n= 8) in one plot and f(x),Pn(x), In(x), and Cn(x)(n= 16) in a new plot. Hint: for better visualisation, you may want to show the errorsas well, i.e., f(x)Pn(x), f(x)In(x)and f(x)Cn(x).

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

Records And Database Management

Authors: Jeffrey R Stewart Ed D, Judith S Greene, Judith A Hickey

4th Edition

0070614741, 9780070614741

More Books

Students also viewed these Databases questions

Question

Discuss the role of PO fit in explaining turnover intention.

Answered: 1 week ago