What are the dependencies for findpeaks.m
古いコメントを表示
Do I need signal processign toolbox to use the findpeaks function?
採用された回答
その他の回答 (1 件)
Joshua Baldwin
2017 年 12 月 18 日
編集済み: Joshua Baldwin
2017 年 12 月 18 日
As noted earlier, the Signal Processing Toolbox is needed. However, I only needed to process a fairly small and basic array of doubles that could be easily iterated through, so I worked around this by writing my own function as follows:
function [pks, locs] = findpeaks(data)
pks = zeros(numel(data), 1);
locs = zeros(numel(data), 1);
count = 0;
for i = 2:(numel(data) - 1)
if (data(i - 1) < data(i)) && (data(i) > data(i + 1))
count = count + 1;
pks(count) = data(i);
locs(count) = i;
end
end
pks = pks(1:count);
locs = locs(1:count);
end
カテゴリ
ヘルプ センター および File Exchange で Spectral Estimation についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!