I need help to plot circle around the points and these points are in a circle. please response
16 次查看(过去 30 天)
显示 更早的评论
this code will generate points in a particular area
n=10; % number of points that you want
center = [2 ,2]; % center coordinates of the circle [x0,y0]
radius = 10; % radius of the circle
angle = 2*pi*rand(n,1);
r = radius*sqrt(rand(n,1));
X = r.*cos(angle)+ center(1);
Y = r.*sin(angle)+ center(2);
plot(X,Y,'.r')
and here is the circle can be drawn as...
center = [2 ,2]; % center coordinates of the circle [x0,y0]
radius = 10; % radius of the circle
angle = 0:.01:2*pi;
r = radius;
X = r.*cos(angle)+ center(1);
Y = r.*sin(angle)+ center(2);
plot(X,Y,'.r')
Problem is that I want to plot circles around each point which are lying inside a given circle. Please help
0 个评论
采纳的回答
KSSV
2016-10-5
n=10; % number of points that you want
center = [2 ,2]; % center coordinates of the circle [x0,y0]
radius = 10; % radius of the circle
angle = 2*pi*rand(n,1);
r = radius*sqrt(rand(n,1));
X = r.*cos(angle)+ center(1);
Y = r.*sin(angle)+ center(2);
plot(X,Y,'.r')
hold on
%%Draw circle
R = 1. ; % radius
th = linspace(0,2*pi) ;
for i = 1:length(X)
x = R*cos(th)+X(i) ;
y = R*sin(th)+Y(i) ;
plot(x,y,'b')
end
hold on
center = [2 ,2]; % center coordinates of the circle [x0,y0]
radius = 10; % radius of the circle
angle = 0:.01:2*pi;
r = radius;
X = r.*cos(angle)+ center(1);
Y = r.*sin(angle)+ center(2);
plot(X,Y,'.b')
2 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Plot Customization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!