Question: Problem 1 A regular polygon is a polygon that is direct equiangular ( all angles are equal in measure ) and equilateral ( all sides
Problem
A regular polygon is a polygon that is direct equiangular all angles are equal in measure and equilateral all sides have the same length The vertices of a regular polygon fall on a circle of radius at equal angular separation. For example, a sided polygon is an equilateral triangle, which can be constructed by connecting lines between vertices located along a circle at and degrees.
Write a program that:
Asks the user for a number between and This will represent the number of sides in a regular polygon.
Asks the user for three numbers between and These will represent an RGB triplet vector identifying a color to be used in constructing a regular polygon.
Define the vertex points for the polygon. The distance of each vertex from the origin will be and there will always be a vertex on the axis.
Construct an RGB triplet vector representing a color using the three numbers entered by the user.
Use the fill function to plot the polygon in a figure with the userselected color. The polygon border should be black with a linewidth of
Do not display the figure axes, but do display a pithy title for the figure different from the example shown below. Ensure that your figure has an aspect ratio of :
Using the numstr function, create a character string that says A x sided polygon" where is replaced by the number of sides selected by the user. Use MATLAB's help function to determine the syntax for the numstr function. Then print this text such that it is vertically located at and is approximately centered horizontally.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
