# Assignment 9

You will write a function script called chebexpansion which computes a Chebyshev polynomial approximation to any function we specify. Specifically your function will satisfy the following criteria.

• Your function will require three arguments: a handle to the function to be approximated; the degree of the polynomial approximate; and a vector of points where the polynomial is to be evaluated. Thus, to run your function we will be able to type something like: chebexpansion(@sin,9,[-1,0,1]).
• Your function will have one output: a vector of values of the polynomial at the points given in the input x. Thus, in the previous example, the output would be a vector [p(-1),p(0),p(1)], where p is the Chebyshev polynomial approximation you calculated.
• Your function can call a function provided here to calculate the coefficients of the expansion in Chebyshev polynomials. In other words, your polynomial will be $\sum_{k=0}^K a_kT_k(x),$ where $$K$$ is the number you gave as a second argument to your function, $$x$$ is essentially the vector you gave as the third argument, and $$a_k$$ is calculated by the little function we provide. Note that the Chebyshev polynomials of the first kind $$T_k$$ are computed in Matlab using the built-in function chebyshevT(d,x) where d is the degree of the Chebyshev basis polynomial, and x is the vector of x coordinates (same as above).

Once your function is working, you will use it to plot Chebyshev polynomial approximations of degree 12 to the three functions you created in Assignment 8. The plots will look something like that in Figure 1. Observe the following things about the plot.

Figure 1: Chebyshev approximation to the Cooper function.
• It has a title. The title tells the degree of the polynomial
• The axes are labeled.
• The curves are different colors. It does not matter what colors you choose.
• The plot has a legend.

You will turn in two things for this assignment: the function script file called chebexpansion.m; and a script in which you call that function in the course of plotting those three degree-twelve approximations. The assignment is turned in when the two .m files containing the scripts are received as attachments to an email message in the instructor's inbox. The assignment is worth 40 points, and is due at 9:00 on Tuesday, 7 November.

The "final exam" for this course will take place at 8:00 AM on Tuesday, 12 December. This will be an ordinary 50 minute test. It will be comprehensive, but weighted toward the latter half of the semester. As always, paper notes will be permitted, but no electronic devices will be allowed.

A Solution example is available for the quiz.

Assignment A is posted.

Department of Mathematics, PO Box 643113, Neill Hall 103, Washington State University, Pullman WA 99164-3113, 509-335-3926, Contact Us
Copyright © 1996-2015 Kevin Cooper