matlab - determine index and value of first negative peak -


i solving funcion uses moving average filter remove noise. how can determine index , value of first , second negative peak after apply filter input data?

use findpeaks on negative of data, extract first 2 elements extract first , second indices of negative peaks located. supposing signal stored in f, do:

[peaks, locs] = findpeaks(-f); p = peaks(1:2); loc = locs(1:2); 

findpeaks works finding local maxima. if want find local minima (i.e. negative peaks), apply findpeaks negative of signal local minima become local maxima, apply same algorithm. loc contain first 2 locations of negative peaks are, while p determine negative peak amplitudes.

however, you'll need play around input parameters findpeaks, instead of using default ones suit data, should enough started.


sidenote

if don't have access findpeaks, take @ this post wrote find peaks fft data. data different, overall logic same. however, finds all peaks - both local maxima , minima. if want find minima, @ negative of signal rather absolute value.


Comments

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -