How do I write a Matlab function to draw a regular polygon.
显示 更早的评论
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
回答(1 个)
Walter Roberson
2013-5-14
0 个投票
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" ?
类别
在 帮助中心 和 File Exchange 中查找有关 Elementary Polygons 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!