0

我正在尝试处理大量数据以寻找周期性行为。换句话说,在两个相应值之间来回跳转的数据。我尝试了许多不同的解决方案,但它们都给出了识别行为的误报。如果第一列是时间,第二列是高度,这是我正在寻找的示例:[0 1000; 5 2000;10 1000;15 2000;20 1000]。在此示例中,高度在 1000 到 2000 英尺之间来回循环。如果有人可以帮我一把,将不胜感激。我正在用 MATLAB 写作。

4

1 回答 1

0

如果仅针对两个连续元素,则可以像这样使用一维过滤:

A =  [-5 8000; 0 1000; 5 2000; 10 1000; 15 2000; 20 1000; 25 3000; 30 1000];
b = A(:,2);
% filtering with 2 elemnts vector. the imaginary part is to avoid
% false-positives from adding different numbers to the same sum
x = conv(b,[1;1j],'valid');
% find unique values and their number of occurrences
[C,ia,ic] = unique(x,'stable');
counts = histcounts(ic,[1:max(ic),inf]);
multiCounts = counts > 1;
% find the repeating patterns
patternFirstIdxs = ia(multiCounts);
patterns = [b(patternFirstIdxs),b(patternFirstIdxs + 1)];

如果您想查找每个模式的所有出现,请查看ia或使用k = strfind(b,pattern)它们中的每一个。

于 2017-04-07T06:38:02.430 回答