Drawing circles in MATLAB

Status
Not open for further replies.

zeeextra

Newbie level 1
Joined
Dec 25, 2010
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,292
Dear All Fellows and Expert User of MATLAB

I have a 2D work plane of 100 mm x 160 mm. In this work plane I want to draw following two series of circles:

Series 1;

Circles filled in the above work plane such that each of circles has radius of 1.5. However the distance between the centers of circles is uniformly distributed with mean of 3.25 mm and standard deviation of 0.083mm

Series 2;

Circles filled in the above work plane such that the distance between the centers of any two circles is 3mm. However the size of the circles is uniformly distributed with mean of 0.75 mm and standard deviation of 0.25.


I will be highly thankful to you if you please help me to plot this geometry. I will be highly thankful to you in this regard
 

i use this instructions for drawing a circle:

x = linspace(-sqrt(10),sqrt(10));
y1 = sqrt(10-x.^2);
y2 = -sqrt(10-x.^2);
plot(x,y1,x,y2)
axis equal

happy new year!
 

n number of normally distributed random numbers with mean m and std deviation d can be obtained like

r = m + d.*randn(100,1);

the following can be used as function to generate circle with given center, radius and number of points to draw circle.


function H=circle(center,radius,nop)
THETA=linspace(0,2*pi,nop);
RHO=ones(1,nop)*radius;
[X,Y] = pol2cart(THETA,RHO);
X=X+center(1);
Y=Y+center(2);
H=plot(X,Y,style);
axis square;
 

You can use the following code:

angle = linspace(0, 2*pi, 360);
x = cos(angle);
y = sin(angle);
plot(x,y)
axis('equal')
ylabel('y')
xlabel('x')
title('Circle')
grid on
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…