How to find local peaks in a 3D plane

조회 수: 2 (최근 30일)
Suzan Wulms
Suzan Wulms 2021년 6월 30일
답변: Akira Agata 2021년 7월 2일
Hello all,
I have a problem in automatically detection of 4 quite obviously present peaks. I transformed my data to a almost flat plane with four peaks in z-direction. I want to automatically detect the locations and corresponding datapoints of the 4 peaks. Does someone know how to solve this problem? I've added my data.
  댓글 수: 1
dpb
dpb 2021년 6월 30일
You could help by supplying the code to do what you've done so far and by telling us what, specifically is the data in the .mat file -- original, transformed by whatever it is you described, ...???

댓글을 달려면 로그인하십시오.

채택된 답변

Akira Agata
Akira Agata 2021년 7월 2일
How about the following?
% Load data
load('positionsplane.mat');
% Arrange it as a table variable
tData = array2table(positionsplanenew,'VariableNames',{'x','y','z'});
% Extract z > 15
idx = tData.z > 15;
tData2 = tData(idx,:);
% Apply k-means clustering
rng('default');
g = kmeans(tData2{:,:},4);
tData2.group = g;
% Find maximam points for each cluster
peaks = splitapply(@max, tData2.z, tData2.group);
idx = ismember(tData2.z, peaks);
% Visualize the result
figure
scatter3(tData.x, tData.y, tData.z, '.')
hold on
scatter3(tData2.x(idx), tData2.y(idx), tData2.z(idx),'r','filled')

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by