Given x=−1:0.2:1, calculate values of y from y=sin2(πx/2). Using these values of x:
a. Generate quadratic and quartic polynomials to fit this data using the least squares MATLAB function polyfit. Display the data and the curve fitted. Hint: Example 7.2 in Section 7.6 gives some guidance.
b. Fit a cubic spline to the data using the MATLAB function spline. Display the data and the fitted spline. Compare the quality of this spline fit with the two graphs from (a). For the data of Problem 7.3, determine the values of y for x=0.85 using the MATLAB function interp1 for a linear, spline, and cubic interpolating function. Also use the MATLAB function aitken.