Matlab - 圆边上的点矩阵

时间:2013-01-09 18:04:40

标签: image matlab

如何在Matlab中找到构成任意半径圆的边缘的点矩阵?如果我绘制这些点,我应该得到一个接近圆的东西(虽然一个光滑的圆由无数个点组成)。

1 个答案:

答案 0 :(得分:2)

radius = 5;                                    %desired radius
numPoints = 1000;                              %Number of points in your circle
angles = linspace(0,2*pi,numPoints)';          %Angles evenly spread around the circle, from 0 to 2*pi radians
xyCircle = radius*[cos(angles) sin(angles)];   %This is the matrix you probably want

plot(xyCircle(:,1), xyCircle(:,2),'.'); %Quick plot to check the result
axis equal;