Have a look please. I made a Matlab code for giving solution to the following problem: A regular polygon of n sides is inscribed in a circle of radius r=1.33. Considering this polygon to consist of identical triangles, calculate the area and perimeter of the polygon for n=6, n=60 and n=600. Also Calculate the perimeter and area of the circle for comparison.
Code: function [area] = ntri(n) r=1.33; circleP=2*pi*r % area= (cos(pi-(pi)/n-degtorad(90))*(sin(pi-(pi)/n-degtorad(90)))/2 % % perimeter=cos(pi-(pi)/n-degtorad(90))*r %determination of hip adjacent angle Had=pi-(pi)/n-degtorad(90); %Determination of the base base=cos(Had)*r; %Hight H=sin(Had)*r; %area of one triangle area1= base*H; %area of all triangles triangles_area=area1*n
It outputes this: >> ntri(6) circleP = 8.3566 triangles_area = 4.5957 >> ntri(60) circleP = 8.3566 triangles_area = 5.5470 >> ntri(600) circleP = 8.3566 triangles_area = 5.5571
you think the calculations are correct?
the area of the triangles and their perimeter should be much closer to the circles for n=600
to debug this, figure out by hand what the area of one triangle is for n=600 and compare that to what your program finds
I did by hand too. I'm just not sure if i got the calculation right...
|dw:1373226732533:dw|
Join our real-time social learning platform and learn together with your friends!