What are the dependencies for findpeaks.m
조회 수: 1 (최근 30일)
이전 댓글 표시
Do I need signal processign toolbox to use the findpeaks function?
댓글 수: 0
채택된 답변
Paulo Silva
2011년 8월 31일
Yes you need the signal processing toolbox for the findpeaks that comes with it.
댓글 수: 3
Walter Roberson
2011년 8월 31일
You do not place functions in a workspace: you place them in a directory. If you place peakfinder.m in any of the directories that are on your MATLAB path, then it will be found.
추가 답변 (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
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Spectral Estimation에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!