Question: matlab please The divide and average method, an old-time method for approximating the square root of any positive number a, can be formulated as x=2x+a/x
The "divide and average" method, an old-time method for approximating the square root of any positive number a, can be formulated as x=2x+a/x Write a well-structured M-file function based on the while ... break loop structure to implement this algorithm. Use proper indentation so that the structure is clear. At ench step estimate the crror in your approximation as c=xnawxnrwxold Repeat the loop until c is less than or equal to a specified value. Design your program so that it returns both the result and the error. Make sure that your program only evaluate the square root of numbers that are equal to and larger than wero. Test your program by evaluating a=0, 3,15,8 with =1104
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
