help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

findpeaks failure on redundant points


From: Fritz Sonnichsen
Subject: findpeaks failure on redundant points
Date: Mon, 7 May 2018 15:51:15 -0400
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

I am running findpeaks on some realworld chemical spectra and it works quite well most of the time. However in the case of a redundant y value it fails to find the peak. I have snipped a subset of the dataset to show this below. If you run the code you will only get one peak at index y=33003.55.    The peak at 63064.69 is not detected. However if you remove the 2nd occurrence of 63064.69, findpeaks can then detect the peak.
Am I missing some parameter here for this or is this  a bug?

Thanks
Fritz
========================================
clear all
pkg load signal
data = [
312.446    7925.49;
312.903    9374.54;
313.36    11117.28;
313.817    12726.53;
314.274    14367.34;
315.187    20680.54;
316.557    24241.28;
317.47    33003.55;
317.926    35064.26;
318.382    28287.45;
318.839    15017.83;
319.295    6056.53;
319.751    2554.04;
320.663    1185.09;
321.575    867.13;
324.765    694.79;
325.22    731.2;
325.675    757.9;
326.131    862.27;
331.136    2702.11;
332.954    3389.01;
333.409    4088.05;
334.317    5578.36;
335.226    9338.13;
335.68    12634.3;
336.588    21462.11;
337.042    27889.39;
337.95    49156.71;
338.404    59644.74;
338.858    63064.69;
338.859    63064.69;
340.672    8942.49;
341.126    3338.04;
341.579    1495.78;
342.033    1034.6;
342.486    884.12;
]
wavel=data(:,1);
inten=data(:,2);
[hite, idx, parms] = findpeaks(inten);
disp(   sprintf("index=%d wavelength=%d intensity=%d \r\n",[idx,wavel(idx),hite]')    );
plot(wavel,inten ,'color','r'  );




reply via email to

[Prev in Thread] Current Thread [Next in Thread]