如何编写求海明距离中的相似矩阵的matlab程序
来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/11/10 20:35:14
如何编写求海明距离中的相似矩阵的matlab程序
这是我的统计矩阵数据,怎么就他的相似矩阵呢,用matlab编程!
X=[100.71,1271490.24,1127.60,343.00,0.57,1.61;407.30,966233.12,982.97,77.00,2.62,7.79;728.55,1122394.58,1059.43,220.00,2.01,6.43;1074.76,1800694.80,1341.90,395.00,1.41,3.89;1156.16,2471091.43,1571.97,240.00,1.37,3.41]
这是我的统计矩阵数据,怎么就他的相似矩阵呢,用matlab编程!
X=[100.71,1271490.24,1127.60,343.00,0.57,1.61;407.30,966233.12,982.97,77.00,2.62,7.79;728.55,1122394.58,1059.43,220.00,2.01,6.43;1074.76,1800694.80,1341.90,395.00,1.41,3.89;1156.16,2471091.43,1571.97,240.00,1.37,3.41]
采用pdist函数
sim=squareform(pdist(X,'hamming'))
结果如下:
sim =
0 1 1 1 1
1 0 1 1 1
1 1 0 1 1
1 1 1 0 1
1 1 1 1 0
sim=squareform(pdist(X,'hamming'))
结果如下:
sim =
0 1 1 1 1
1 0 1 1 1
1 1 0 1 1
1 1 1 0 1
1 1 1 1 0