Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please answer using MATLAB Problem 2 (10 pts) Below shows the Taylor Series equivalent of the inverse tangent of x: (-1)n z2n+1 2n +1 3
Please answer using MATLAB
Problem 2 (10 pts) Below shows the Taylor Series equivalent of the inverse tangent of x: (-1)n z2n+1 2n +1 3 5 79 for-1sr You will use MATLAB to approximate arctan(z) using the above Taylor Series. In MATLAB, the upper bound of the summation cannot be set to infinity, instead you have to choose a value to stop evaluating the Taylor Series. The value you will use is N 10 a) Calculate the Taylor Series expansion of arctan(0.5) using upper bound N10 using a while loop b) Calculate the Taylor Series expansion of arctan(0.5) using upper bound N 10 using a for loop. Set c) Does the while loop and the for loop Taylor series expansion approximately give the sa? Give d) Calculate the percent error by comparing the result of the Taylor Series of arctan(0.5) with the actual Set the result equal to the variable T1 the result equal to the variable T2 you answer as a comment value e) Use tic and toc to measure the time required to calculate arctan(0.5) using the built-in function arctan), using the for loop, and using the while loop. Using fprintf, display the time elapsed for each. (Hint: suppress the statement automatically displayed when using tic and toc by setting toc equal to a variable.) Remember to include units! Please submit one 'm file for this assignment. The solutions to both problems should be in the same .m fileStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started