Question: Matlab Question : Regarding the check for possible numerators to go along with q, would the same output be obtained if we just checked round(pi/q)

Matlab Question : Regarding the check for possible numerators to go along with q, would the same output be obtained if we just checked round(pi/q) instead of both floor(pi/q) and ceil(pi/q)?

refer to the script pictured below:

Matlab Question : Regarding the check for possible numerators to go along

asterE otepa File Edit Format View Help % Script FasterEg3_1 % Rational Approximation of pi % Acquire the numerator/denominator limit M input(' Enter M: ' ); % Initializations pBest = 1; qBest 1; err_pq abs(pBest/qBest - D1); % Error in current best fraction % Best numerator found so far.. % Best denominator .. found so far . % Check out all possible denominators for q = 1: cell(M/pi) % For this q, find the best numerator pe errMinus abs(p1 pMinus/g); pMinus = floor(pi'q); if errMinus

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!