# (Solved): please answer 7 a,b,c 7. Use MATLAB to fit various piecewise polynomials to the Runge function, usin ...   7. Use MATLAB to fit various piecewise polynomials to the Runge function, using the same nodes as in part (a) of exercise 4. (a) Find the piecewise linear interpolant of . (You may use MATLAB routine interp1 or write your own routine. Type help interp1 in MATLAB to find out how to use interp1.) (b) Find the piecewise cubic Hermite interpolant of . (Write your own routine for this, using formulas (8.17) and (8.18).) (c) Find a cubic spline interpolant of . (You may use either the interp1 command or the spline command in MATLAB.) In each case above, plot and the interpolant on the same graph. If you wish, you can put all of your graphs on the same page by using the subplot command. 4. (a) Use MATLAB to fit a polynomial of degree 12 to the Runge function interpolating the function at 13 equally-spaced points between -5 and 5. (You can set the points with the command .) 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 using MATLAB's polyval routine, or you may write your own routine. Turn in your plot and a listing of your code.

We have an Answer from Expert