我目前遇到了标题中提到的问题。如果我只想要3个不同的点,并且将它们记录为matlab中具有3个坐标的点,那么很容易实现,如下所示:
A=[0 0 1];%coordinates of Q1
B=[0 0 -1];%coordinates of Q2
C=[0 1 0];%coordinates of Q3
因此,这描述了点A(0,0,1),B(0,0,-1),C(0,1,0)的坐标。在进一步的计算中,我可以使用这些坐标并进行计算,例如:
R1=A-B; %vector from Q2 to Q1
R2=A-C; %vector from Q3 to Q1
R3=C-B; %vector from Q2 to Q3
然而,如果我想生成100个类似于随机的点,则上述方法是愚蠢的。而且,由于坐标更方便,我还想像以前一样使用它们。以下是我尝试过的方法。
% random distributed points
x = rand(Number_of_Points, 1);
y = rand(Number_of_Points, 1);
z = x.^2 + y.^2;
Points = [x(:) y(:) z(:)];
但是它只记录了所有点的3个坐标,我无法像以前那样单独记录它们。我想通过使用Points(1)-Points(2)
来计算向量。有人知道怎么做吗?
pdist
。 - Dan