What are the dependencies for findpeaks.m

3 次查看(过去 30 天)
Do I need signal processign toolbox to use the findpeaks function?

采纳的回答

Paulo Silva
Paulo Silva 2011-8-31
Yes you need the signal processing toolbox for the findpeaks that comes with it.
You can do your own findpeaks function or get one from File Exchange
I recommend this one: PeakFinder
Also look at this
  3 个评论
Paulo Silva
Paulo Silva 2011-8-31
yes if by workspace you mean current directory
Walter Roberson
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
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

类别

Help CenterFile Exchange 中查找有关 Multirate Signal Processing 的更多信息

标签

尚未输入任何标签。

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by