How do I write a Matlab function to draw a regular polygon.
Mostrar comentarios más antiguos
Using the heading function drawPolygon(n, r, colstyle)
where n=no of sides
r= is the radius of the circle that would be large enough to enclose the polygon
colstyle=is the colour and line style to be used for the plotting
Respuestas (1)
Walter Roberson
el 14 de Mayo de 2013
0 votos
If you think about following along the circle, if you do not start at a vertex, then after passing "n" vertices, you return to the starting point. The polygon is regular, so the sides must be equal, so the angles must be equal. So then, at what fraction of the circle must the angle between one vertex and the next cover?
Now, how would you find the list of points that are (for example) all Pi/17 radian apart on a circle of radius "r" ?
Categorías
Más información sobre Elementary Polygons en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!