Question: Please post complete matlab solution 2. The divide and average method is an old time method for approximating the square root of any positive number
Please post complete matlab solution
2. The divide and average method is an old time method for approximating the square root of any positive number a. It can be formulated as: 2 where the initial value of x can be any positive number greater than zero. Write a well-structured M-file function based on the while. . .break loop structure to implement this algorithm. At each step estimate the error in your approximation as: XnewXold Tnew Repeat the loop until the error is less than or equal to a specified value, known as tolerance. The input variables for the function should be the initial x value, tolerance error value, and a. The outputs of the function should be the square root, error, and number of iterations required to achieve the desired tolerance. Prepare a table that summarizes the function outputs when a-64 tolerance=104, and the initial x value varies between 0.1, 5 and 100. Use the format long option to report a with 16 digits
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
