how to write a detection algorithm for the peaks of a signal
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
i have to load a GSR signal in Matlab and then i have to process it...for that i need to write a code to detect the peaks of the signal but i don t know how to do that...i need some links or files (or an example code) that can help me with that...THANKS!!!
0 Commenti
Risposte (2)
Image Analyst
il 5 Apr 2020
Try findpeaks() if you have the Signal Processing Toolbox:
[peakValues, indexesOfPeaks] = findpeaks(gsrSignal);
plot(gsrSignal, 'b-');
hold on;
plot(indexesOfPeaks, peakValues, 'rv', 'MarkerSize', 15);
If you don't get what you like, then there are lots of options for findpeaks to tweak how it finds the peaks.
0 Commenti
Peng Li
il 5 Apr 2020
That depends on what exactly you meant by peaks of a signal. If you want to have all local maximums, the easiest way I think is to apply a first order difference. If y is your signal, diff(y) is the first order forward difference.
dy = diff(y);
A local maxima is corresponding to the point that its two corresponding differences are with different signs.
index = find(dy(1:end-1) .* dy(2:end) < 0);
This is just an example of a working algorithms. You may need to modify here and there to meet you actual needs.
0 Commenti
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!