# Finding coordinates of peaks

1 visualizzazione (ultimi 30 giorni)
A il 7 Giu 2012
Hello,
I have a data file that looks like this: http://imageshack.us/photo/my-images/26/peakds.jpg/ and I would like to return the position of the two highest peaks. Does anyone have any neat ways of doing this?
Thanks,
##### 2 CommentiMostra NessunoNascondi Nessuno
A il 7 Giu 2012
Ideally, I would like to smooth out this curve. I am currently looking for functions to do this, any advice would be greatly appreciated.
A il 7 Giu 2012
Solved the problem, used http://www.mathworks.com/matlabcentral/fileexchange/17986

Accedi per commentare.

### Risposte (1)

Kevin Sharp il 7 Giu 2012
You need to first perform non-maximal suppression and then sort the remaining data.
Try this ...
x = 1:100;
data= sin(.2*x+1)+sin(.5*x+2)+sin(.7*x+3);
figure;
plot(data,'b-');
hold on;
%non-maximal suppression
data(ordfilt2(data,3,[1 1 1])>data) = 0;
%sort data
[v,i] = sort(data,'descend');
plot(i(1:2),v(1:2),'rx')
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Categorie

Scopri di più su Descriptive Statistics in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by