This question is closed. Reopen it to edit or answer.

Bit Error Rate using Test Data

1 view (last 30 days)
Kawther on 30 Nov 2014
Closed: MATLAB Answer Bot on 20 Aug 2021
Dear All,
I have the below code. I want to find the bit errr rate b considering the clustered data as a trained data and send a test data. Can i do that by updates on this code?
clear all
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];
[idx, centroids] = kmeans(X, 4, 'Replicates', 20);
x = X(:,1);
y = X(:,2);
colors = 'rgbk';
[X,Y] = meshgrid(-5:0.05:5, -5:0.05:5);
X = X(:);
Y = Y(:);
hold on;
for idx = 1 : numel(X)
[dummy,ind] = min(sum( ...
bsxfun(@minus,[X(idx),Y(idx)], centroids).^2, 2));
plot(X(idx), Y(idx), [colors(ind), '.']);
hold on;
colors = 'rgbk';
for num = 1 : 4
plot(x(idx == num), y(idx == num), [colors(num) '.']);
plot(centroids(:,1), centroids(:,2), 'c.', 'MarkerSize', 14);grid;
Thank you :)

Answers (0)

Community Treasure Hunt

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

Start Hunting!