educational course/tutorialoutlet.com educational course/tutorialoutlet.com | Page 3

of the maximum absolute error from parts ( b ) - ( d ). In particular , for parts ( b ) and ( c ), explain how your results are supported by what we saw in class regarding the bound of the maximum absolute error . Problem 2 : Taylor ‘ s polynomials for the sine function For this problem , you will approximate the sine function by its Taylor polynomials of increasing degree . The Taylor expansion for the sine function around x0 0 is sin x ¸8 p1qk x2k 1 x x3 p2k 1q ! 3 ! k0 x5 5 !
and it holds for all x P R . Your program will support this claim by plotting the Taylor polynomials ¸ p1qk x2k p2k 1q ! k0 N 1 which approach the sine function as N increases . Write a Matlab function with the definition function [ c ] = sinPoly ( n ) where c is the vector of n Taylor polynomial is n ). 1 coefficients of the Taylor polynomial of order n ( i . e . the highest order of the Your function should check that the input variable n is odd . If it is even , it should print an error message and return c = 0 . You may find the mod function useful here . Using your sinPoly function , plot on the same axes the function sinpxq and the Taylor polynomials of degree 5 , 9 , 13 , 17 , 21 in r2π , 2πs on a grid of 1000 equally spaced points . You may use polyval to evaluate the polynomials on the grid . Use a legend to label the plotted curves and