HWAr Practice Problem 2 (MATLAB) [while loops, if-else statements, error function] The following is the Maclaurin series expansion of the...
, which is valid for
HWAr Practice Problem 2 (MATLAB) [while loops, if-else statements, error function] The following is the Maclaurin series expansion of the mathematical function 1:1(1 + x), which is valid for —1 < :L' < 1: DO (_1)n+1 11:]. n n ln(1+m):m—%m2+%a:3—im4+...= a; Step 1 Write a function named anfOnePlusX that uses a while loop to determine how many terms in the series are required for the following condition to bemet: actualia ow _—W < 10 3actual The function should have a: as its only input and the number of terms as its only output.Strategy: Start by answering the following questions: 1. What will the loop expression be?2. What variables need to be initialized before the loop?3. What variables need to be updated/incremented inside the loop? Testing: a: = 0.1 and a; = 0.2 are good candidates for "hand" calculations to test your logic and code. (Feel free to use MATLAB to crunch the numbers!) Use this table to check (_1)n+1 (.1me 0'1: mamas—approxTl. —27 actual (sum of ﬁrst 71 terms) your code for a: : 0.1 n