[Scilab-users] Peaks and valleys [was: Forum dedicated to Scilab developments -> practical concern]

paul.carrico at free.fr paul.carrico at free.fr
Fri Oct 7 14:37:41 CEST 2016


Thanks Christophe for the "coup de main" (i.e for the help) 


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) 


In a more general way, thanks to the community for the previous exchanges 


Paul 

----- Mail original -----

De: "Dang Ngoc Chan, Christophe" <Christophe.Dang at sidel.com> 
À: "Users mailing list for Scilab" <users at lists.scilab.org> 
Envoyé: Vendredi 7 Octobre 2016 10:50:18 
Objet: Re: [Scilab-users] Peaks and valleys [was: Forum dedicated to Scilab developments -> practical concern] 

Hello, 

> De : paul.carrico at free.fr 
> Envoyé : jeudi 6 octobre 2016 12:32 
> 
> thanks for the information and the link 

I updated the source code on the following page 
https://commons.wikimedia.org/wiki/File:Savitzky-golay_pic_gaussien_bruite.svg 
(vectorised, faster). 

Concerning the use of the Savitzky-Golay algorithm itself, 
once the algorithm is applied, something like 
band = (sign(Ysecond (1:$-1)).*sign(Ysecond (2:$))==1) 
will give you where the second derivative sign changes, 
i.e. the bands where a peak or a valley lie, 
and find(band) will give you the indices. 

Then, you can search the min or the max in each band (on the smoothed data) 
which should give you the position of the peaks and valeys. 

I suggest to test several width of the window for each set of data 
(the degree of the polynomial should always be 3 IMHO) 
too let your brain finally decide what is a peak/valley and what is not. 

HTH 

-- 
Christophe Dang Ngoc Chan 
Mechanical calculation engineer 
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. 
_______________________________________________ 
users mailing list 
users at lists.scilab.org 
http://lists.scilab.org/mailman/listinfo/users 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20161007/4c9475bb/attachment.htm>


More information about the users mailing list