1. . Method 1: It consists of calculating a by dividing the perimeter of an N-sided regular polyg...
1. . Method 1: It consists of calculating a by dividing the perimeter of an N-sided regular polygon inscribed in a unit circle of radius 1 (r= 1). You will be creating a matrix of values with 5 different polygons; starting off with a square (4 sides) and up to a polygon with 64 sides. This method requires a few matrices: number of sides of the polygon, corresponding theta values – see diagram, lengths of each side of the corresponding polygons, the values of the perimeter of each polygon, approximate value of 1 and the percent error compared to the actual value of The diagram is a 6-sided polygon inscribed in a circle: Note that the radius is 1 which is also the value of one of the sides of a triangle in the polygon. Also note that triangles here are isosceles triangles. You should be able to calculate the value of theta and the length of each side of this polygon. s r=1
A step-by-step algorithm to calculate an approximation for it, using Method 1: a) Create a 1 by 5 matrix, or row vector, N, representing the number of sides of the polygon, where N has 4, 8, 16, 32 and 64 sides. b) Compute a row vector, theta (O), whose elements correspond to those of the array, N. You need to calculate the value of based on the number of sides of the polygon and knowing that a full circle is 360 degrees. (Do not use a calculator in doing the calculations, you should be using MATLAB operations to determine these values.) c) Compute a row vector, s, representing the length of each side of the polygon, whose elements correspond to those of the array, N (note that you now have calculated the angle within each triangle and that two of the sides of the triangle are equal to 1; the value of each side can be calculated using trigonometric identities). d) Compute a row vector, perimeter, representing the perimeter of each N-sided polygon (in general, the perimeter is the addition of each side of the polygon). e) Compute a row vector, pi_approx, whose elements correspond to the array, N. For a circle, the actual value of t is the ratio of the circumference to the diameter (c = Tod and = ). Therefore, It is approximately: perimeter/(2*r). Using this information, compute pi_approx, for each polygon. f) Compute the final row vector, error_percent, whose elements represent the percentage error in pi_approx versus the actual value of 1 and corresponding to the elements of array N. The pi _approx - 7 percentage error is defined as: 100 x abs 77 g) Llastly, plot the percent error. The percentage error will be on the vertical (y) axis and N should be on the horizontal (x) axis. The plot command is as follows: plot(x, y) where x is the horizontal value and y is the vertical value. Label your graph and the axes using the commands: title('relative error'); xlabel('number of sides of the polygon'); vlabel("error percent) %).
Solved
Advanced Accounting
1 Answer
Sample Only
Login to view answer.