Info
This question is closed. Reopen it to edit or answer.
Bit Error Rate High Values
2 views (last 30 days)
Show older comments
Dear All,
I am using this code to find the bit error rate for the Kmeans clustering algorithm for receving a QPSK modulated data. Running the code high BER values are obtained (something more than 80). Can anyone help me with that ASAP.
clear all
clc
T=[ 2+2*i 2-2*i -2+2*i -2-2*i];
A=randn(150,2)+2*ones(150,2); C=randn(150,2)-2*ones(150,2);
B=randn(150,2)+2*ones(150,2); F=randn(150,2)-2*ones(150,2);
D=randn(150,2)+2*ones(150,2); G=randn(150,2)-2*ones(150,2);
E=randn(150,2)+2*ones(150,2); H=randn(150,2)-2*ones(150,2);
X = [A; B; D; C; F; E; G; H];
for k=1:5
[idx, centroids] = kmeans(X, k, 'Replicates', 20);
x = X(:,1);
y = X(:,2);
BER=[];
for nn=1:4
ber=0;
gt = zeros(1,4);
for idx = 1 : 4
[dummy,gt(idx)] = min(sum(bsxfun(@minus, [real(T(idx)), imag(T(idx))],...
centroids).^2, 2));
end
randn('seed',123);
rand_ind = randi(4, 10, 1);
test_sequence = T(rand_ind);
gt_labels = gt(rand_ind);
x = real(test_sequence).*(nn*randn(1, 10));
y = imag(test_sequence).*(nn*randn(1, 10));
labels = zeros(1, 10);
for idx = 1 : 10
[dummy,labels(idx)] = min(sum(bsxfun(@minus, [x(idx), y(idx)],...
centroids).^2, 2));
end
ber = sum(labels ~= gt_labels) / 10 * 100;
BER=[BER ber];
end
plot(nn,BER)
end
Thank you very much. Kawther
0 Comments
Answers (0)
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!