Question: 2.) Some practice with loops. Do this exercise in MATLAB, print your code and turn it in. It is known that the infinite sum 2n=1

2.) Some practice with loops. Do this exercise in MATLAB, print your code and turn it in. It is known that the infinite sum 2n=1 on = 1 + + + + ... equals exactly 1. nel 2n (a) Using a for... end loop, calculate the sum which uses the first 12 terms of this series. [Answer: 0.999755859375000. To get MATLAB to display all those digits, try typing format long at the beginning of yur script.] (b) Using a while... end loop find out how many terms you need to calculate until the sum reaches 0.999999. To do this, you'll need to keep running your while loop as long as the sum is less than 0.999999. You'll also need to keep track of how many times you've gone through the loop with a variable
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
