我使用pdist命令查找x和存储在一个矩阵y坐标之间的距离。MATLAB pdist功能
X = [100 100;
0 100;
100 0;
500 400;
300 600;];
D = pdist(X,'euclidean')
它返回一个15元素的向量。 :
[0.734979755525412 3.40039811339820 2.93175207511321 1.83879677592575 2.40127440268306 2.75251513299386 2.21488402640753 1.10610649500317 1.81674017301699 0.903207751535635 1.99116952754924 1.05069952386082 1.24122819418333 1.08583377275532 1.38729428638035]
有没有办法将这些距离与他们从来源的坐标,即它们存储在与一般的行形成矩阵相关联:
[Length xcoordinate1 ycoordinate1 xcoordinate2 ycoordinate2]
哪里有一排各发现长度?
在此先感谢
你的例子是否正确?我得到了一个10 *元素的*非常*不同的值。 – gnovice 2010-03-19 15:39:25
你可能会发现有用的另一个功能是SQUAREFORM http://www.mathworks.com/access/helpdesk/help/toolbox/stats/squareform.html – Amro 2010-03-19 20:05:41