Question: Write a function with the header function [piEstimate, piError] = myForPi (n!terations) which uses a forloop and the Archimedes method below to estimate the value

 Write a function with the header function [piEstimate, piError] = myForPi

Write a function with the header function [piEstimate, piError] = myForPi (n!terations) which uses a forloop and the Archimedes method below to estimate the value of pi (you must use this approach). I. Let A = 1 and N=6 2. Repeat the following niterations times a. Replace N by 2N b. Replace A by [2-sart[4-AA2} ] 1 /2) C. Let L NA/2 d. Let U = L/sqrt(1-A^2/2) e. Let pEstimate = (U + L)/2 f. Let piError=U-L)/2 3. Return Test Functions >> [piEst, piErr] = myForPi (2) 3.160015969288298 piErr 0.027387356007061 >> [piEst, piErr] = myForPi (4) piEst 3.142715953186386 piErr = 0.001684002295856 >> [piEst, piErr] = myForPi (10) 3.141592927281175

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!