[Scilab-users] find and locate local maxima

Stéphane Mottelet stephane.mottelet at utc.fr
Tue Mar 16 17:45:53 CET 2021


Hi

For real life signals you should rather use something like this 
(Savitsky-Golay filters)

https://codereview.scilab.org/#/c/21499/

S.

Le 16/03/2021 à 17:09, CHEZE David 227480 a écrit :
>
> Hi Clément,
>
> Thank you for your quick reply and solution ! Actually it’s working 
> for simple data but with noisy experimental timeseries, some filtering 
> is required to get perfect regular signal (between the ‘true’ extrema) 
> that could be then managed by the routine. I suppose this is something 
> the Matlab/Octave is handling internally, with some parameters as 
> function’s argument to tune it, maybe it’s not the case .
>
> Regards,
>
> David
>
> *De :* users <users-bounces at lists.scilab.org> *De la part de* Clément 
> David
> *Envoyé :* mardi 16 mars 2021 16:27
> *À :* Users mailing list for Scilab <users at lists.scilab.org>
> *Objet :* Re: [Scilab-users] find and locate local maxima
>
> Hello David,
>
> After reading the Matlab documentation page, it seems pretty simple to 
> implement using Scilab : and $ symbols:
>
> function[*pks*, *locs*]=_findpeaks_(*data*)
>
> ii = find(d(1:$-2) < d(2:$-1) & d(2:$-1) >= d(3:$));
>
> *pks* = *data*(ii+2);
>
> *locs* = ii + 2;
>
> endfunction
>
> data= [25 8 15 5 6 10 10 3 1 20 7];
>
> _plot_(data)
>
> [pks,locs]= _findpeaks_(data);
>
> _plot_(locs,pks, 'xr');
>
> Note: using oct2py and pims might also be an option for simple cases 
> but these wrappers are complex to use and data need to be copied at 
> language boundaries.
>
> Regards,
>
> Clément
>
> *From:*users <users-bounces at lists.scilab.org 
> <mailto:users-bounces at lists.scilab.org>> *On Behalf Of *CHEZE David 227480
> *Sent:* Tuesday, March 16, 2021 2:53 PM
> *To:* Users mailing list for Scilab <users at lists.scilab.org 
> <mailto:users at lists.scilab.org>>
> *Subject:* [Scilab-users] find and locate local maxima
>
> Hi all,
>
> I’m looking for function that could find and locate every local maxima 
> of any discrete time signal (timeseries), similar to Matlab or Octave 
> function findpeaks(), scipy find_peaks(). Is anyone aware if something 
> similar is already available in Scilab ? (I already browsed a little 
> bit and it don’t seem so…)
>
> If not in Scilab macros, any hint to use the Octave or scipy function 
> directly from Scilab?
>
> More globally it seems that Octave Forge could be linked with Python 
> (from oct2py import octave
>
> # Load the Octage-Forge signal package.
>
> octave.eval("pkg load signal")), does someone ever tried to bridge 
> similarly in Scilab ? oct2sci
>
> Kind regards,
>
> David
>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users

-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

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


More information about the users mailing list