<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: times new roman,new york,times,serif; font-size: 12pt; color: #000000'>Thanks Christophe for the "coup de main" (i.e for the help)<div><br></div><div>I started to have a look on it in order to determine how I can use it in my project; the main goal remains to include such tool in optimization loops involving a fully "automatic" search (one path of reflexion among others)</div><div><br></div><div>In a more general way, thanks to the community for the previous exchanges</div><div><br></div><div>Paul<br><br><hr id="zwchr"><div style="color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>De: </b>"Dang Ngoc Chan, Christophe" <Christophe.Dang@sidel.com><br><b>À: </b>"Users mailing list for Scilab" <users@lists.scilab.org><br><b>Envoyé: </b>Vendredi 7 Octobre 2016 10:50:18<br><b>Objet: </b>Re: [Scilab-users] Peaks and valleys [was: Forum dedicated to Scilab developments -> practical concern]<br><br>Hello,<br><br>> De : paul.carrico@free.fr<br>> Envoyé : jeudi 6 octobre 2016 12:32<br>><br>> thanks for the information and the link<br><br>I updated the source code on the following page<br>https://commons.wikimedia.org/wiki/File:Savitzky-golay_pic_gaussien_bruite.svg<br>(vectorised, faster).<br><br>Concerning the use of the Savitzky-Golay algorithm itself,<br>once the algorithm is applied, something like<br>band = (sign(Ysecond (1:$-1)).*sign(Ysecond (2:$))==1)<br>will give you where the second derivative sign changes,<br>i.e. the bands where a peak or a valley lie,<br>and find(band) will give you the indices.<br><br>Then, you can search the min or the max in each band (on the smoothed data)<br>which should give you the position of the peaks and valeys.<br><br>I suggest to test several width of the window for each set of data<br>(the degree of the polynomial should always be 3 IMHO)<br>too let your brain finally decide what is a peak/valley and what is not.<br><br>HTH<br><br>--<br>Christophe Dang Ngoc Chan<br>Mechanical calculation engineer<br>This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.<br>_______________________________________________<br>users mailing list<br>users@lists.scilab.org<br>http://lists.scilab.org/mailman/listinfo/users<br></div><br></div></div></body></html>