A simple rugged script that finds the peaks and troughs of a signal, vector, or data points. The results are returned in two index vectors p and t.
Notice: Might drop end points or give two point where adjacent data have the same value.
Returns column-wise peak and through index vectors
Nagi Hatoum (2021). peaks (https://www.mathworks.com/matlabcentral/fileexchange/7694-peaks), MATLAB Central File Exchange. Retrieved .
Can you give me an example of peak.m.How I can adapt peak.m into my file? This is the command:
%imported data from excel sheet
I really appreciate your help and also others response.
Excellent! The code is very helpful. Simple and genius.
It is really helpful for finding peaks and troughs in any signal. Thank you!!
Outdated - see other comments.
Check out EXTREME.M on this site, it is a great improvement, also for 2D!
Works well, exactly what I was looking for. Thanks
this is rubbish, just use Diff() and don't bother downloading
Is it possible to add a script/function to measure the absolute vertical distance between peaks and corresponding troughs?
Overall the function worked well identifying peaks and their horizontal location for me.
great code, could use comments!
No usable help text provided. It is unclear what the function does without testing it. Poor programming practices.
In this article,can the author give me a example of the use of the peak.m.
Why can't I produce the same figure above?
Waiting for other friends help me?!
Thanks, I don't have the latest Matlab version
Xmax = find(diff(X,2)<0)==1)+1;
Xmin = find(diff(X,2)>0)==1)+1;
There are at least two entries in Matlab File Exchange- "Local min, max, nearest neighbour" from 2003-03-21 and "Find Peak Value" from 2003-12-10 that do exactly the same as this function.
1. Function PEAKS exists in R14.
2. vector has to be a column.
3. Will those commands do the same thing?
Xmax = find(diff(diff(X)<0)==1)+1;
Xmin = find(diff(diff(X)>0)==1)+1;
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!