How I separate codewords on the basis of hamming Distance?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
e.g I have 5 code words 1111 , 1123 , 1223 , 1342 , 1234. Out of these I want to separate those codewords such that their hamming distance with all possible pair is three .
1 Kommentar
Walter Roberson
am 26 Jan. 2018
It is not clear what the difference is between this question and your earlier question https://www.mathworks.com/matlabcentral/answers/378953-how-to-separate-code-words-on-the-basis-of-hamming-distance
Antworten (1)
Walter Roberson
am 26 Jan. 2018
"How I separate codewords on the basis of hamming Distance"
One way:
A = {'1111' , '1123' , '1223' , '1342' , '1234'};
num_clusters = 3;
nA = 0+vertcat(A{:});
D = squareform(pdist(nA,'hamming')) * length(A{1});
cluster_idx = kmeans(D, num_clusters);
"Out of these I want to separate those codewords such that their hamming distance with all possible pair is three "
The meaning of that is not clear.
In each of the entries, the initial '1' is the same, so in order for the hamming distance to be 3, every position would have to be different. If we use that as the rule, then we can see that
'1111' and '1123' are the same in column 2, so they cannot have a hamming distance of 3, so they need to go into the same group.
'1123' and '1223' are the same in column 3, so they cannot have a hamming distance of 3, so they need to go into the same group. That puts '1111', '1123' and '1223' in the same group so far.
'1223' and '1234' are the same in column 2, so they cannot have a hamming distance of 3, so they need to go into the same group. That puts '1111', '1123', '1223' and '1234' in the same group so far.
Now consider '1342'. The '3' does not match a '3' in column 2 of any of the entries in the group; the 4 does not match a '4' in column 3 of any of the entries in the group; the '2' in column 4 does not match a '2' in column 4 of any of the entries in the group. So we can provisionally assign '1342' to a different group.
Having reached the end of the list, we have '1111', '1123', '1223' and '1234' in one group, and '1342' in another group, and every member of the first group is hamming distance 3 to every member of the other group. Is this the grouping that was being looked for?
But '1111' is hamming distance 3 to '1223' and '1234', so it is not clear that '1111' belongs in the same group as '1223' and '1234' ??
0 Kommentare
Siehe auch
Kategorien
Mehr zu Modify Image Colors finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!