Question: Problem 1 A regular polygon is a polygon that is direct equiangular ( all angles are equal in measure ) and equilateral ( all sides

Problem 1
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 r at equal angular separation. For example, a 3-sided polygon is an equilateral triangle, which can be constructed by connecting lines between vertices located along a circle at 0,120, and 240 degrees.
Write a program that:
Asks the user for a number between 3 and 13. This will represent the number of sides in a regular polygon.
Asks the user for three numbers between 0 and 1. 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 10, and there will always be a vertex on the +y-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 user-selected color. The polygon border should be black with a linewidth of 2.
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 1:1.
Using the num2str() function, create a character string that says "A x sided polygon" where x is replaced by the number of sides selected by the user. Use MATLAB's help function to determine the syntax for the num2str() function. Then print this text such that it is vertically located at y=0 and is approximately centered horizontally.
 Problem 1 A regular polygon is a polygon that is direct

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!