【问题标题】:Identifying cyclical behavior using MATLAB使用 MATLAB 识别周期性行为
【发布时间】:2017-04-06 21:27:14
【问题描述】:

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

【问题讨论】:

    标签: matlab data-analysis repeat altitude


    【解决方案1】:

    如果它仅适用于 两个 顺序元素,您可以像这样使用一维过滤:

    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)

    【讨论】:

    • 不只是两个连续的元素,可能会有多个值。但我会研究 ia 或 k = strfind(b,pattern)。感谢您的回复!
    猜你喜欢
    • 1970-01-01
    • 2021-12-23
    • 1970-01-01
    • 2014-07-20
    • 2015-09-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-10
    相关资源
    最近更新 更多