perimerter = s x n where n number of sides s length of a side apothem = s/2tan (
ID: 3793836 • Letter: P
Question
perimerter = s x n where n number of sides s length of a side apothem = s/2tan (180/n)area = apothem x perimeter /2
write a matlab scipt to determine the side length of a regular polygon given the numbers of sides and the are
area = ? number of sides = ? side length = ? perimerter = s x n where n number of sides s length of a side apothem = s/2tan (180/n)
area = apothem x perimeter /2
write a matlab scipt to determine the side length of a regular polygon given the numbers of sides and the are
area = ? number of sides = ? side length = ? perimerter = s x n where n number of sides s length of a side apothem = s/2tan (180/n)
area = apothem x perimeter /2
write a matlab scipt to determine the side length of a regular polygon given the numbers of sides and the are
area = ? number of sides = ? side length = ?
Explanation / Answer
%%save as polygonarea.m
%%The script file that takes number of sides
%%side lenght as arguments and calcualtes
%%area of polygon and store in area
function area=polygonarea(numSides, lenSide)
%%calculate perimeter
perimeter=numSides*lenSide;
%%convert radians to degress
angle=180*3.1415/180;
%%calculate apothem
apothem=lenSide/(2*tan(angle/numSides));
%%calculate area
area=(perimeter*apothem)/2;
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
Note : Run the script file name from the matlab command prompt
Sample output:
where 6 is number of sides, 10 is the lengt of the side.
--> polygonarea(6,10)
ans =
259.8169
-->
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.