Why 'Linkage' returns wrong result??

8 Ansichten (letzte 30 Tage)
YF
YF am 23 Mai 2012
I use the distance matrix as W =
0 1 0 5
1 0 0 1
0 0 0 3
5 1 3 0
>> Z=linkage(W,'single')
Z =
2.0000 3.0000 2.2361
1.0000 5.0000 2.2361
4.0000 6.0000 5.1962
>> Z=linkage(W,'complete')
Z =
2.0000 3.0000 2.2361
1.0000 5.0000 4.2426
4.0000 6.0000 7.6811
above are wrong results
Somebody could tell me why,please??

Antworten (1)

Tom Lane
Tom Lane am 24 Mai 2012
Your distance matrix isn't in the vector form that pdist computes and linkage expects. So linkage is treating it as a data matrix. Try this:
Z=linkage(squareform(W),'single')
  1 Kommentar
YF
YF am 24 Mai 2012
O,it works,thank you for your help

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by