Write the function getCircle which is called as [x,y]=getC​ircle(cent​er,radius)

6 vues (au cours des 30 derniers jours)
Kelark Azer Habashi
Kelark Azer Habashi le 13 Fév 2018
to get the x and y coordinates of points that fall on a circle. The circle should be centered at center (2-element vector containing the x and y values of the center) and have the provided radius. The function should return x and y such that a call to plot(x,y) will plot the circle. Note that going around a circle centered on the origin is going around from angle t = 0 to 2pi. In this case the x and y coordinates on a unit circle centered on the origin of radius 1 are x(t ) = cos (t )and y(t) = sin(t). The points can be scaled to the correct radius by multiplying by radius. The point can translated to have a center other than the origin by adding the center to each point. Write a program that uses getCircle to draw circles and makes a plot with 3 circles of radius 1,3,5 centered on (6,6) and 3 circles of radius 1,3,5 centered on (-6,6). The circles of radius 1,3, and 5 should be of different colors, and should use the same color for each value of radius in the two sets of circles.

Réponses (1)

Image Analyst
Image Analyst le 13 Fév 2018
The FAQ on creating a circle should give you a good start: http://matlab.wikia.com/wiki/FAQ#How_do_I_create_a_circle.3F

Catégories

En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by