Using a polynomial to model a function can be very useful, but it is always dangerous to extrapolate beyond your data. We can demonstrate this pitfall by modeling a sine wave as a third-order polynomial a) Define x = -1:0.1:1 ) Calculate y = sin (x) Use the polyfit function to determine the coefficients of a third-order polynomial to model these data, Use the polyval function to calculate new values of y (modeled_y)based on your polynomial, for your x vector from -1 tol Plot both sets of values on the same graph. How good is the fit? . How Create a new x vector, new_x -4:0.1:4, ) Calculate new_y values by finding sin (new_x), a) Extrapolate new_modeled_y values by using polyfit, the

Fig: 1

Fig: 2

Fig: 3

Fig: 4

Fig: 5

Fig: 6

Fig: 7

Fig: 8

Fig: 9