how i can do this geometry program

In order to have a closed geometric figure composed of straight lines , angles in figure must sum
( - 2) ( 180 ) degrees
Where n is the number of sides .
a) Try this statement yourself by creating a vector called n from 3 to 6 and calculate the sum of angle from the formula. Compare what you know about geometry with his answer.
b ) Write a program that enjoin the user to enter one of the following : Triangulo
Square Pentagon Hexagon
Use the entry to set the value of n using a switch / case structure ; then use n to calculate the sum of the interior angles of the figure.
c ) Rephrase your program from part b so use a menu.

답변 (1개)

Image Analyst
Image Analyst 2016년 2월 28일
편집: Image Analyst 2016년 2월 28일

0 개 추천

My shape recognition demo may help you. There is a function in it to create regular polygons. This is the code to look for:
%----------------------------------------------------------------------------------------------------------------------------------
% Create a single polygon with the specified number of sides in a binary image of the specified number of rows and columns.
% centroidToVertexDistance is the distance from the centroid to each vertex.
% If centroidToVertexDistance is a length 2 vector, then this indicated the minimum and maximum size range and
% it will create a random size polygon between the min and max distance.
function binaryImage = CreatePolygon(numSides, centroidToVertexDistance, rows, columns)
Feel free to adapt it to your needs.

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

제품

질문:

2016년 2월 28일

편집:

2016년 2월 28일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by