Question: Write a Matlab function called sine_Taylor that inputs a positive integer n, a number x, and outputs the nth Taylor polynomial of the sine function.

Write a Matlab function called sine_Taylor that inputs a positive integer n, a number x, and outputs the nth Taylor polynomial of the sine function. Compute the absolute and error for n = 1: 10 at x = 1, obtained by comparing the output of your function to that of Matlab's built in sine function. Type on the Matlab console format long, then compute the previous error. Repeat the operation by typing format short. Comment on the result (quantify the difference). Make three plots of the absolute error: loglog, semilogx, and semilogy. The axes should be properly labeled. If you make plots of the logarithms of the data you will not receive full credit. Decide which of the three plots gives you a linear error decay. Then use the points n = 5: 8, and the polyfit function to obtain the form of the error. Write down the theoretical error as a function of n. Compare the result to your actual error. What happened to the points n = 9, 10 on your plots
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
