K-means clustering method

3 ビュー (過去 30 日間)
William Hanson
William Hanson 2018 年 8 月 17 日
回答済み: William Hanson 2018 年 8 月 17 日
I have a set of lightning data I am trying to cluster by k-means. I am using a k-pick plot graph of point to centroid distances to determine the appropriate number of clusters to choose and then setting a for loop to iterate up to 10 times (see below code). The issue that I am running into is that it is plotting less clusters than I am specifying... why is this? Any help would be appreciated.
all_LTG = [LTGlon,LTGlat];%combine the lat/lon LTG data into one matrix
j=4; %k clusters selected from kpickplot
[LTGidx2,LTGC2,LTGsum2,LTGD2] = kmeans(all_LTG,j,'replicates',10,'display','final');
ptsymb = {'bs','r^','md','go','c+','y*','k.'}; %assign symbols and colors for different clusters
for i=1:j
LTGclust = find(LTGidx2==i);
plot(all_LTG(LTGclust,1),all_LTG(LTGclust,2),ptsymb{i});
hold on
end
plot(LTGC2(:,1),LTGC2(:,2),'ko');
plot(LTGC2(:,1),LTGC2(:,2),'kx');
hold off
title('LTG: Cluster Plot')
xlabel('Longitude º ')
ylabel('Latitude º ')
xlim([-35 55]);
ylim([-40 40]);
  2 件のコメント
William Hanson
William Hanson 2018 年 8 月 17 日
all_LTG = [LTGlon,LTGlat];%combine the lat/lon LTG data into one matrix
j=4;%k clusters selected from kpickplot
[LTGidx2,LTGC2,LTGsum2,LTGD2] = kmeans(all_LTG,j,'replicates',10,'display','final');
ptsymb = {'bs','r^','md','go','c+','y*','k.'}; %assign symbols and colors for different clusters
for i=1:j LTGclust = find(LTGidx2==i); plot(all_LTG(LTGclust,1),all_LTG(LTGclust,2),ptsymb{i}); hold on end
plot(LTGC2(:,1),LTGC2(:,2),'ko');
plot(LTGC2(:,1),LTGC2(:,2),'kx');
hold off
title('LTG: Cluster Plot')
xlabel('Longitude º ')
ylabel('Latitude º ')
xlim([-35 55]);
ylim([-40 40]);
Image Analyst
Image Analyst 2018 年 8 月 17 日
Can you attach the data we need to run this? Make it easy for people to help you after you read this link

サインインしてコメントする。

回答 (1 件)

William Hanson
William Hanson 2018 年 8 月 17 日
Lightning data in .csv attached

Community Treasure Hunt

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

Start Hunting!

Translated by