Question: MATLAB**** Part B.) the final output needs to be in a table format like I attached. the expressions/formulas are included as well! I did all




. 1. The "divide and average" method, an old-time method for approximating the square root of any positive number a, can be formulated as x + a/x 2 a. Do this by hand for 5 iterations and compute relative true error (%) and relative approximate error (%) as terms are added. (You may use the square root function on your calculator or Excel to calculate the true square root). Create a table that shows the iteration number, calculated value of the square root of a, relative true error (%) and relative approximate error (%). b. Write a Matlab function to implement this method. Compute relative true error (%) (that you can calculate based on the built-in square root function) and relative approximate error (%) for your answer. The code should run until it reaches either a maximum number of iterations (specified by the user) or a stopping criterion (such as a minimum relative approximate error, specified by the user in %). Table " il Kold Knew 1 25 13 2 13 7146154 3 7.46154 5.40603 5.40603 501525 5 5.015255.0000 2 True Val/ Rel Approx Eer Rel The Eir 5 92.8089 160.00% 5 74,227 % 49,23 % 5 38,023 % 8,1217 5 3.792% 0.305 % 0.304 % 0.00047 divide and average x+(a/x) 2. now know- Xebat relative approximate error => E = xnew In these terms: knew Xold & a xold 2 la = 25 25 + 25 25 li 13 - x(1) 2 13+ 25 13 2 7.46154 = x(2) 25 5.40603 7.4615 4+ x(3) 7.46154 2 25 5.40603 + 5.40 603 = 5. 01525 = x(4) 2. 5.015 25+ 25 5.01525 - 5. 00002 = xL5) 2 N Rel Approx Error E- xold - Knew xnew 100% i = 1 13 25 - 13 .100 o = 92.308 4 = 0, i-z 13-7.46154 7, 46154 - 1687 74.227 % 11 Ez i-3 7.46154-5,40603 5.40603 -100 = 38.023% = 3 i=4 5.40603- 5.01525 5.01525 .160 = 7.7927. - E4 = 5 5.0/525 - 5.00002 ldo = 0.304 %. - Es 5.00002 3 Rel. True Error: y new True value RE True value 'True 1007 13 - 5 5 * 100% = 160.000 7- RE, i=2 7.46154 - 5 5 x 100% = 49.2317; = RE 2 i=3 5.40603-5 el 100% = 8.121 7, -RES 5 16=4 5.01525-S * 1% = 0.3059 - RE. 5 (i=s 5. 00002-5 x 100% = 0.0004 % = RES s Table : i Kold Knew 1 25 13 13 7.96154 3 7.46154 5.40603 4 5.015255.00002 2 True Vall Rel Approx Erol Rel The Eir 5. 92.3089.100.00% 5 74.227% 49.231% 5 38.023% 8.12102 3.792% 5.40603 15.01525 0.305 % UN 5 0.364 7 0.000470
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
