[45 pts] Part 1 For and "While" loops in MATLAB i. Consider the approximation for sin[x] given in homework #2 as: x3 x5 x7 x9 x11 x13...
Submission Instructions: Your solutions to this assignment must be typed and neatly presented. Unorganized solutions and/or solutions that do not present the required deliverables will not be graded and receive a score of zero.This assignment is to be submitted, in PDF/ MS Word format.
- Attachment 1
- Attachment 2
- Attachment 3
1. [45 pts] Part 1 — "For" and “While” loops in MATLABi. Consider the approximation for sin[x] given in homework #2 as: x3 x5 x7 x9 x11 x13 x15 x17 ' = ——+———+———+———+—3"“ x 3! 5! 7! 9! 11! 13! 15! 17! Create a vector where each element is a term of the series. Allow the user to input the valueof x [as a scalar}. Sum the terms of the series using a "for" loop and create a formatted outputto show the user [1) the value of the approximation, [2] the actual value of sin[x] [from theMATLAB function] and [3] the error between the two. Use values x = 2, 2.5, 3 to compare. ii. Now consider the generalized form of the Taylor series for sin[X]:2n+1 . _ m _ n xSlux‘ ;( 1) (2n,+ 1)! Sum the first 100 terms of the series and show the result as a formatted output identical tothat of 1[i]. Allow the user to input the value of); as a scalar. Repeat this problem with thefirst 250 terms. Compare the results. [Use same X values as from [i]].
Show more