I want to make 4 clusters using k mean clustering and for each of the 4 clusters i want to set centroid initially and then accordingly make the cluster. how can I.
1 view (last 30 days)
Show older comments
X3=[-6.189; -3.251; 2.926; 6.534; 10.79; 5.203; -4.465; 1.42; -8.66; -0.8748; 6.534 ; 11.251] ;
Y3=[ 1.393; 10.42; 6.639; 5.821; 8.425; 2.924; 1.139; 0.7508; -7.917; -6.928; -10.01; -7.03; 5.639];
X3 and Y3 are my corrdinates of data.
I want 4 clusters whose centroid would be (x_b,y_b)
x_b=[0.7298; 3; -5.23; 11.86];
y_b=[12.48; -1.497; -6.139; -3.23];
how can i do this..?
0 Comments
Accepted Answer
KSSV
on 29 Mar 2022
X3=[-6.189; -3.251; 2.926; 6.534; 10.79; 5.203; -4.465; 1.42; -8.66; -0.8748; 6.534 ; 11.251] ;
Y3=[ 1.393; 10.42; 6.639; 5.821; 8.425; 2.924; 1.139; 0.7508; -7.917; -6.928; -10.01; -7.03; ];
x_b=[0.7298; 3; -5.23; 11.86];
y_b=[12.48; -1.497; -6.139; -3.23];
P = [X3 Y3] ; % points
G = 4 ; % number of groups
C = [x_b y_b] ; % centroids
idx = kmeans(P,G,'MaxIter',10,'Start',C);
gscatter(P(:,1),P(:,2),idx)
0 Comments
More Answers (0)
See Also
Categories
Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!