for finding peak. i tried findpeaks(). but its not working

3 次查看(过去 30 天)
for the given
waveform
  2 个评论
Adam
Adam 2014-8-6
You need to give more information really. In what way does it not work? Assuming the waveform you show there is in discrete form in an array I would think findpeaks should work ok.
I sometimes find myself wanting to write my own peak-finding algorithm after trying findpeaks, but that usually comes from me identifying something specific about its output that I don't like and can't seem to paramaterise well enough to give what I want. For a general case it should be fine though.

请先登录,再进行评论。

回答(2 个)

Nir Rattner
Nir Rattner 2014-8-6
编辑:Nir Rattner 2014-8-6
Assuming that the image provided is the input format for the signal, you can use the “find” function with a threshold to get all of the black pixels which represent the signal. You may need to use the “smooth” function to get remove some of the unwanted blurriness and noise from the signal. At that point you can simply use the “findpeaks” function with the “y” data:
I = imread('PPG.jpg');
% Threshold to pull signal pixels
[y, x] = find(I(:, :, 1) < 150);
% Smooth to remove image artifacts
ySmooth = size(I, 1) - smooth(x, y, 0.02);
plot(x, ySmooth, 'r');
hold on;
axis equal;
% Find peaks of Y Data
[peaks, locations] = findpeaks(ySmooth);
plot(x(locations), ySmooth(locations), 'o');

Chad Greene
Chad Greene 2014-8-6

Community Treasure Hunt

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

Start Hunting!

Translated by