2017-04-06 54 views
0

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

回答

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)为他们每个人。

+0

它不只是两个连续的元素,可能会有多个值。但我会研究ia或k = strfind(b,pattern)。我很感谢你的回应! –