The Taylor's series expansion for cosx about x = 0 is given by: where x is in radians. Write a
where x is in radians. Write a user-defined function that determines cosx using Taylor's series expansion. For function name and arguments, use y = cosTay (x), where the input argument x is the angle in degrees and the output argument y is the value for cosx. Inside the user-defined function, use a loop for adding the terms of the Taylor's series. If an is the nth term in the series, then the sum Sn of the n terms is Sn = Sn€“1 + an. In each pass, calculate the estimated error E given by E= |Sn-Sn-1/Sn-1|. Stop adding terms when E Use cosTay for calculating:
Compare the values calculated using cosTay with the values obtained by using MATLAB's built-in cosd function.
This problem has been solved!
Step by Step Answer: