How to detect isolated points in a vector

9 ビュー (過去 30 日間)
CSCh
CSCh 2023 年 9 月 21 日
コメント済み: CSCh 2023 年 9 月 22 日
Hi,
I have a vector (see attachment), and I would like to detect isolated points (marked with red cicles in the image). Isolated in that sense, that same values have a certain distance to these. I would need the indices.
Thank you
Chris
  4 件のコメント
CSCh
CSCh 2023 年 9 月 21 日
Dear Joshi, thanks for your answer. please have a kook to the provided example, in the attachment.
Dyuman Joshi
Dyuman Joshi 2023 年 9 月 21 日
I have seen the image. It does not do a good job of explaining what you mean by "isolated points".
That is why I asked for more information.
Provide a mathematical explaination of the criteria to use to determine which points are isolated points.
Make it easy for us to help you.

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

採用された回答

Harald
Harald 2023 年 9 月 21 日
編集済み: Harald 2023 年 9 月 21 日
Hi,
I believe this code does what you ask for:
load outputVector.mat
N = 500;
isolated = false(size(iidx));
L = length(iidx);
for k = 1:L
left = max(1,k-N):k-1;
right = k+1:min(L,k+N);
isolated(k) = ~any(iidx([left, right]) == iidx(k));
end
result = find(isolated);
plot(iidx, "*")
hold on
plot(result, iidx(isolated), "ro")
hold off
I don't see an obvious way to avoid the loop. If there are concerns about performance, I can think about it a bit more - or perhaps, others have an idea.
Note that it does not identify two of the points that you have circled. If you zoom in, you will see that there are two consecutive identical values there. My understanding is that you did not want to extract these, even though they look isolated on the first glance? If you wanted these, I do not fully understand the question yet.
Best wishes,
Harald
  1 件のコメント
CSCh
CSCh 2023 年 9 月 22 日
Hi Harald, thank you so much.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOrange についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by