matlab代写:ECS130 Homework Assignment #3

ECS130 Homework Assignment #3 Due: 4:00pm, Feburary 17, 2017

  1. Prove that interpolating polynomial is unique. That is Pn(x) and Qn(x) are two polynomialswithe degree less than n that agree at n distinct points, then they agree at all points.
  2. (a) Interpolate the following data by each of the interpolants polyinterp, piecelin, pchiptxand splinetx. Plot the results for −1 ≤ x ≤ 1:

    xy -1.00 -1.0000 -0.96 -0.1512

-0.65 0.3860

        0.10      0.4802
        0.40      0.8838
        1.00      1.0000

(b) What are values of each of the four interpolants at x = −0.3? Which of these values do you prefer? Why?

(c) The data were actually generated from a low-degree polynomial with integer coefficient. What is that polynomial?

  1. Make a plot of your favorite object. Start with
                  figure(’position’, get(0,’screensize’))
                  axis(’position’,[0 0 1 1])
                  [x,y] = ginput;
    

    Place your favorite object on the computer screen. Use the mouse to select a few dozen points outlining your object. Terminate the ginput with a carriage return.

    Now think of x and y as two functions of an independent variable that goes from one to the number of points you collected. You can interpolate both functions no finer grid and plot the result with

                   n = length(x);
                   s = (1:n)’;
                   t = (1:0.05:n)’;
                   u = splinetx(s,x,t);
                   v = splinetx(s,y,t);
                   clf reset
                   plot(x,y,’.’,u,v,’-’);
    

    Do the same thing with pchiptx. Which do you prefer?

  2. The M-file rungeinterp.m provides an experiment with a famous polynomial interpolation

problem due to Carl Runge. Let

f(x) = 1 , 1+25×2

and let Pn(x) denote the polynomial of degree n−1 that interpolates f(x) at n equally spaced points on the interview −1 ≤ x ≤ 1. Runge asked whether, as n increases, Pn(x) converges to f(x). The answer is yes for some x, but no for others. Find for what x, does Pn(x) → f(x) as n → ∞?

1

5. Ranking sport teams. Suppose we have four college teams, call T1, T2, T3 and T4. These four teams play each other with the following outcomes:

• T1 beats T2 by 4 points: 21 to 17. • T3 beats T1 by 9 points: 27 to 18. • T1 beats T4 by 6 points: 16 to 10. • T3beatsT4by3points: 10to7. • T2 beats T4 by 7 points: 17 to 10.

To determine ranking points r1, r2, r3, r4 for each team, we do a least squares fit to the overdetermined system:

r1−r2 = 4, r3−r1 = 9, r1−r4 = 6, r3−r4 = 3, r2−r4 = 7.

In addition, we fix the total number of ranking points, i.e., r1 + r2 + r3 + r4 = 100. Find the values of r1, r2, r3, r4 that most closely satisfy these equations, and based on your results rank the four teams.1

  1. Find the polynomial of degree 10
    p(t)=β1t10 +β2t9 +···+β10t+β11that best fits the function f(t) = cos(4t) at equally-spaced point t between 0 and 1. Set up the design matrix X and right-hand side vector y, and determine the polynomial coefficients β = (β1,…,β11) in two different ways:

    (a) By solving the normal equation XT Xβ = XT y. This can be done in MATLAB by typing beta= (X′ ∗X)\(X′ ∗y)

    (b) By using the MATLAB backslash command beta = X\y (which uses a QR decomposition). Print the results to 16 digits (using format long e) and comment on the difference you see.

    Note: you can compute the condition number using MATLAB built-in function cond.

  2. In censusgui.m, change the 1950 population from 150.697 million to 50.697 million. The produces an extreme outliner in the data. Which models are the most affected by this outliner? which models are least affected?
  3. Letx=[9,2,6]T.
    (a) Find the Householder reflection H that transforms x into −11  Hx= 0 .

    (b) Find nonzero vectors u and v that satisfy
    Hu = −u

    Hv = v

1This method of ranking sport teams is a simplification of one introduced by Ke Massey in 1997. It has evolved into a part of the famous BCS (Bowl Championship Series) model for ranking college football teams and is one factor in determining which teams play in bowl games.

2