Question: using a while loop on MATLab point plot). HW1_3 problem 3.13/4.1 The 'divide and average' method, an old-time iterative method for approximating the square root
point plot). HW1_3 problem 3.13/4.1 The 'divide and average' method, an old-time iterative method for approximating the square root of any positive number a, can be formulated as x = **a/X. Write a MATLAB code (script) to find the square root of 15 correct to 4 significant figures and use an fprintf statement to write your final answer to the screen. Hints: 1. Note that a 15 in this case as you are trying to find the square root of 15. Start with an initial value of x. An intelligent initial guess can be x-a/2. 2. Use a while loop to calculate the updated value of x according to the above iterative formula x = For example, if you start with x=a/2, le, x=7.5 initially, then the next updated value of x calculated by your code inside the while loop should be x = **/* = (7.5+ 15/7.5)/2=4.75. Thus, at this stage the current value of x is 4.75 and the old value of x is 7.5. Accordingly calculate the relative error, e, to properly construct a while loop. *18/2 x 3. Implement the stopping condition for 4 sig figs accuracy and display the last updated value of x as your final answer after you come out of the while loop
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
