1 function [symb, centroids]= sd_kmeans(X,c)
2 % K-means soft decision digital demodulation
4 % SYMB = DD_KMEANS(X,C)
6 % X - input constellation points
7 % C - reference constellation
8 % SYMB - demodulated symbols
9 % centroids - Cluster centers
10 % Robert Borkowski, rbor@fotonik.dtu.dk
11 % Technical University of Denmark
12 % Modified by Miguel Iglesias Olmedo, miguelio@kth.se
13 % v3.0, 10 October 2015
15 s = warning(
'error',
'stats:kmeans:FailedToConverge'); % Change error to warning
17 options =
struct(
'MaxIter',15);
18 [symb, centroids] = kmeans(X,numel(c),
'onlinephase',
'off',
'options',options,
'start',c,
'emptyaction',
'singleton');
20 switch exception.identifier
21 case 'stats:kmeans:FailedToConverge' 22 % warning(
'K-means did not converge. Using hard-decision.');
29 warning(s); % Reenable error(?)
31 symb = uint16(symb(:));
function hd_euclid(in X, in c)
Euclidean metric hard decision digital demodulation.