フィルターのクリア

Is there a way to detect a drop in values in an array?

19 ビュー (過去 30 日間)
Leo Müller
Leo Müller 2015 年 11 月 9 日
コメント済み: Image Analyst 2015 年 11 月 9 日
Hello, I would like to know if there is a way to detect a sudden drop in values in an array. Matlab should see when a gap starts and tell me in which class it happens. How do I get Matlab to recognize the large gap which starts in class 16 (see picture).
Here is the reason: My program should be able to recognize two piles of points. Therefore I have computed all distances from each point to an fixed vector (in each slice/plane). Afterwords I have classed them by distance. The gap in the classes means, that there is also a big gap between the points. Thus a new pile of points begins. Thank you.

採用された回答

Image Analyst
Image Analyst 2015 年 11 月 9 日
編集済み: Image Analyst 2015 年 11 月 9 日
You can threshold to find all elements less than a certain number:
lowAmounts = amount < 10; % Logical vector - use find() if you want actual indexes.
Or you can use findpeaks() in the signal Processing Toolbox to find valleys in your data
[peakValues, locations] = findpeaks(-amount);
Or you can use the diff() function to find big changes from one element to the next
differences = diff(amount);
bigDrops = differences < -15; % or whatever value you want.
They're slightly different, so it just depends on what you want exactly.
  2 件のコメント
Leo Müller
Leo Müller 2015 年 11 月 9 日
Thank you, I will try it out!
Image Analyst
Image Analyst 2015 年 11 月 9 日
Actually I forgot to invert the amounts in findpeaks. I corrected it, and the correct line is:
[invertedPeakValues, locations] = findpeaks(-amount);

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by