4. (a) Use MATLAB to fit a polynomial of degree 12 to the Runge function 1...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
4. (a) Use MATLAB to fit a polynomial of degree 12 to the Runge function 1 f(x) = 1 + x interpolating the function at 13 equally-spaced points between -5 and 5. (You can set the points with the command x = [-5:5/6:5];-) You may use the MATLAB routine polyfit to do this computation or you may use your own routine. (To find out how to use polyfit type help polyfit in MATLAB.) Plot the function and your 12th-degree interpolant on the same graph. You can evaluate the polynomial at points throughout the interval [-5, 5] using MATLAB's polyval routine, or you may write your own routine. Turn in your plot and a listing of your code. (b) Repeat part (a) with a polynomial of degree 12 that interpolates f at 13 scaled Chebyshev points, x = 5 cos j 12 j= 0,..., 12. Again you may use MATLAB's polyfit and polyval routines to fit the poly- nomial to the function at these points and evaluate the result at points throughout the interval, or you may use the barycentric interpolation for- mula (8.6) with weights defined by (8.5) or (8.16) to evaluate the interpo- lation polynomial at points other than the interpolation points in the inter- val [-5, 5]. Turn in your plot and a listing of your code. (c) If one attempts to fit a much higher-degree interpolation polynomial to the Runge function using MATLAB's polyfit routine, MATLAB will issue a warning that the problem is ill conditioned and answers may not be accu- rate. Still, the barycentric interpolation formula (8.6) with the special weights (8.16) for the values of a polynomial that interpolates f at the Chebyshev points may be used. Use this formula with 21 scaled Cheby- shev interpolation points, x = 5 cos ,j=0,..., 20, to compute a more accurate approximation to this function. Turn in a plot of the interpolation polynomial P20 (x) and the errors f (x)- P20 (x) over the interval [-5, 5]- (d) Download the chebfun package from the website http:// www2.maths.ox.ac.uk/chebfun/ and follow the directions there to install the package. Enter the Runge function into chebfun as in example 8.5.2: f=chebfun (1/(1+x.^2).[-5.5]) and then plot the result by typing plot (f). Also plot the actual Runge func- tion on the same graph. The two should be indistinguishable. 4. (a) Use MATLAB to fit a polynomial of degree 12 to the Runge function 1 f(x) = 1 + x interpolating the function at 13 equally-spaced points between -5 and 5. (You can set the points with the command x = [-5:5/6:5];-) You may use the MATLAB routine polyfit to do this computation or you may use your own routine. (To find out how to use polyfit type help polyfit in MATLAB.) Plot the function and your 12th-degree interpolant on the same graph. You can evaluate the polynomial at points throughout the interval [-5, 5] using MATLAB's polyval routine, or you may write your own routine. Turn in your plot and a listing of your code. (b) Repeat part (a) with a polynomial of degree 12 that interpolates f at 13 scaled Chebyshev points, x = 5 cos j 12 j= 0,..., 12. Again you may use MATLAB's polyfit and polyval routines to fit the poly- nomial to the function at these points and evaluate the result at points throughout the interval, or you may use the barycentric interpolation for- mula (8.6) with weights defined by (8.5) or (8.16) to evaluate the interpo- lation polynomial at points other than the interpolation points in the inter- val [-5, 5]. Turn in your plot and a listing of your code. (c) If one attempts to fit a much higher-degree interpolation polynomial to the Runge function using MATLAB's polyfit routine, MATLAB will issue a warning that the problem is ill conditioned and answers may not be accu- rate. Still, the barycentric interpolation formula (8.6) with the special weights (8.16) for the values of a polynomial that interpolates f at the Chebyshev points may be used. Use this formula with 21 scaled Cheby- shev interpolation points, x = 5 cos ,j=0,..., 20, to compute a more accurate approximation to this function. Turn in a plot of the interpolation polynomial P20 (x) and the errors f (x)- P20 (x) over the interval [-5, 5]- (d) Download the chebfun package from the website http:// www2.maths.ox.ac.uk/chebfun/ and follow the directions there to install the package. Enter the Runge function into chebfun as in example 8.5.2: f=chebfun (1/(1+x.^2).[-5.5]) and then plot the result by typing plot (f). Also plot the actual Runge func- tion on the same graph. The two should be indistinguishable.
Expert Answer:
Related Book For
Numerical Methods For Engineers
ISBN: 9780071244299
5th Edition
Authors: Steven C. Chapra, Raymond P. Canale
Posted Date:
Students also viewed these databases questions
-
Why has little progress has been made toward the ambitious goals set at the 1 9 9 2 Earth Summit in Rio de Janeiro?
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
A process has an in-control fraction nonconforming of p = 0.01. The sample size is n = 300. What is the probability of detecting a shift to an out-of-control fraction nonconforming of p = 0.05 on the...
-
Assume high school coach Emily Williams has seven possible swimmers for a four-person relay team. a. If the order for the freestyle relay is unimportant, how many different relay teams are possible?...
-
(i) Give a recursive definition for the set ODD = {1 3 5 7 . . . }. (ii) Give a recursive definition for the set of strings of digits 0, 1, 2 , 3, . . . 9 that cannot start with the digit 0.
-
Identify each of the following assets as a plant asset (P) or an intangible asset (I): 1. Franchises 2. Vehicles 3. Buildings 4. Furniture 5. Patents 6. Copyrights 7. Trademarks 8. Land improvements
-
On January 1, Intergen, Inc., invests $200,000 for a 40 percent interest in Ryan, a new joint venture with two other partners each investing $150,000 for 30 percent interests. Intergen plans to sell...
-
Linda's Luxury Travel (LLT) is considering the purchase of two Hummer limousines. Various information about the proposed investment follows: Initial investment (2 limos) Useful life Salvage value...
-
Crystal Corporation processes its journal vouchers using batch procedures similar to the process outlined in Figure in the text. To improve customer satisfaction, the sales system is going to be...
-
During an investigation, a detective found my client's blood at the crime scene along with a file folder on a computer that contained emails. This file was labeled "Potential Divorce." How could...
-
Why is the free cash flow valuation model so widely used?
-
Identify four ratios that measure how effectively a firm is managing its assets, and write out their equations.
-
Indicate whether each of the following statements is true or false by writing T or F in t he a nswer c olumn. The Electronic Signatures in Global and National Commerce Act pertains only to cases in...
-
A fault in a product that creates a hazardous condition that causes injury. a. product fl aw b. design de fect c. strict lia bility d. Master Settlement Agreement e. product lia bility f. failure to...
-
What information is provided on the Internet in addition to the stocks latest price?
-
apling Learning can learning The indicator thymol blue has two color transitions as indicated in the table at the right. Select the color expected when thymol blue is added to solutions having the...
-
Listed below are several terms and phrases associated with basic assumptions, broad accounting principles, and constraints. Pair each item from List A (by letter) with the item from List B that is...
-
Repeat Prob. 11.18, but for the case of a six-dimensional Vandermonde matrix (see Prob. 10.14) where x 1 = 4, x 2 = 2, x 3 = 7, x 4 = 10, x 5 = 3, and x 6 = 5.
-
Soft tissue follows an exponential deformation behavior in uniaxial tension while it is in the physiologic or normal range elongation. This can be expressed as
-
Use the midpoint method with h = 0.5 and 0.25 to solve Prod. 25.1.
-
How does the presence of a whistle-blowing process improve quality control and independence at a public accounting firm?
-
Trish Mulcahy, a new junior in your office, says that she does not understand why she cannot work on the audit of a company that is a client of your firm and that is owned by her uncle. Trish says...
-
How do these standards differ for (1) errors, (2) frauds, (3) direct-effect illegal acts, and (4) far-removed-effect illegal acts?
Study smarter with the SolutionInn App