フィルターのクリア

Extracting some points and finding some nearest elements.

1 回表示 (過去 30 日間)
sreelekshmi ms
sreelekshmi ms 2020 年 3 月 8 日
コメント済み: sreelekshmi ms 2020 年 3 月 11 日
I have data I used dbscan clustering method. Now I need to find 5 different elements from each cluster. And calculate the 5 nearest elements of each point and group it.
In the below figure there are some points marked(pencil marked)and grouped the 5 elements(black round).
[I marked only 3 clusters just for example, I need it in the full clusters.]
After that how can I remove those clusters that do not have 5 nearest elements? Anybody, please help me.
clc;
clear;
data=xlsread('glass.xlsx');
minpts=6;
epsilon=4;
[idx, corepts] = dbscan(data,epsilon,minpts);
gscatter(data(:,1),data(:,2),idx);

回答 (1 件)

Image Analyst
Image Analyst 2020 年 3 月 8 日
I don't even think you need dbscan for this. You just need to define a length that separates "near enough" and "too far away". Then you just check every point in the array to see if it has 5 that are near enough, and keep those.
nearEnough = 0.02; % Whatever you want.
x = data(:,1);
y = data(:,2);
indexesToKeep = false(1, length(x)); % Initialize to not keeping any of them.
for k = 1 : length(x)
distances = sqrt((x(k) - x).^2 + (y(k) - y).^2);
if sum(distances > nearEnough) >= 5
% At least 5 are close enough to this k'th point, so keep this point.
indexesToKeep(k) = true;
end
end
x = x(indexesToKeep);
y = y(indexesToKeep);
  12 件のコメント
sreelekshmi ms
sreelekshmi ms 2020 年 3 月 10 日
At-least In the glass data set how can I apply the above steps I described. Please help me.
sreelekshmi ms
sreelekshmi ms 2020 年 3 月 11 日
Is there any way to divide the data based on dense areas. If any, please help me.

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

カテゴリ

Help Center および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by