根据欧几里德距离:MATLAB在圆周周围创建等距点

时间:2017-08-11 06:20:02

标签: matlab geometry

我想要一个圆上的N个点,由欧几里德距离(直线,不在圆周周围)50分开。半径由点数和连续点之间的距离决定。

然而,当我选择其中一个点作为参考并计算到其他点的距离时,我得不到任何等于50的距离值。

以下是我的代码:

N        =  100;    % number of points
eclddst  =  50;     % euclidean distance between adjacent points
r        =  eclddst/(2*sin(pi/N));         % radius of the circle 
cord     =  r*exp((0:1/(N-1):1)*pi*2*1i)'; % coordinates
XCor     =  real(cord);
YCor     =  imag(cord);
N_COORD  =  [XCor YCor];
% taking location 3 as the reference point to check the distance between the points
DSTNT    =  sqrt( (N_COORD(3,1)-N_COORD(:,1)).^2 + ( N_COORD(3,2)- N_COORD(:,2)).^2)';  

我获得的第三点附近的距离值是:

100.959
 50.505
  0.000
 50.505
100.959
151.311

第3点附近的点应该有50作为距离值,而不是50.505

为什么会出现此错误? 提前谢谢。

0 个答案:

没有答案
相关问题