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
-
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...
-
Refer to the Nature (March 20, 2008) study of whether the saying "nice guys finish last" applies to business, Exercise 11.14. Recall that college students repeatedly played a version of the game...
-
This is a negotiation between Tracy and Pat for the sale of a beautiful, old Victorian house with wood siding on a large lot in a residential neighborhood. The house needs expensive repairs. The...
-
In general how have interest rates changed since the late 1980s according to Figure 11.1? FIGURE 11.1 Interest and Inflation Rates, 1988-2010 10p Rate (%) 8 6 10-Year Treasury Bonds 4 2 AAA Corporate...
-
Sawaya Co., Ltd., of Japan is a manufacturing company whose total factory overhead costs fluctuate considerably from year to year according to increases and decreases in the number of direct...
-
An 85 kg man is completing a workout with TRX suspension straps. Holding this position in static equilibrium he experiences a pulling force on his hands of 600 N at an angle of 160 o relative to the...
-
Presented below is information related to the sole proprietorship of Helen Archer, attorney. Legal service revenue2020 ...........$330,000 Total expenses2020 ........................211,000 Assets,...
-
A boy wants a car and some money before leaving his parent's house. His father tells him he will give him a car and $15,000 if he works in the family store for a year, and the boy accepts. Seven...
-
How did the 2017 TCJA change U.S. firms incentive to repatriate foreign profits?
-
What were two potential concerns with the new system under TCJA?
-
Wild Swings Inc.s stock has a beta of 2.4. If the risk-free rate is 5.9% and the market risk premium is 6.9%, what is an estimate of Wild Swings cost of equity?
-
You have invested in GreenFrame, Inc. The CEO owns 4% of GreenFrame and is considering an acquisition. If the acquisition destroys $58 million of GreenFrames value, but the present value of the CEOs...
-
Laurel, Inc., has debt outstanding with a coupon rate of 6.1% and a yield to maturity of 7.1%. Its tax rate is 38%. What is Laurels effective (after-tax) cost of debt?
-
What is your opinion about efficiency and usefulness of new concepts such methods, models, initiatives, papers about flood protection and management?
-
The first national bank pays a 4% interest rate compound continuously. The effective annual rate paid by the bank is __________. a. 4.16% b. 4.20% c. 4.08% d. 4.12%
-
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.
-
Draw a block diagram for the feedback control of a liquid-level system, which consists of a valve with a control knob (0\%-100\%) and a liquid-level sensor. Clearly label essential components and...
-
A control system is represented using the block diagram shown in Figure 10.59. Sketch the root locus with respect to the proportional control gain K. Determine all the values of \(K\) for which the...
-
Roughly sketch the root locus with respect to \(K\) for the equation of \(1+K L(s)=0\) and the following choices for \(L(s)\). Make sure to give the asymptotes, arrival or departure angles, and...
Study smarter with the SolutionInn App