[Scilab-users] Envelop of a noisy curve

Samuel Gougeon sgougeon at free.fr
Fri Apr 24 21:03:23 CEST 2015


Hello,
Le 24/04/2015 14:05, paul.carrico at free.fr a écrit :
> Dear All,
>
> I am absolutly not familiar with "signal processing" field, so my question is probably naïve: how can I proceed to get the envelop curve (maximum values) of a non periodic noisy signal ?
Here is an example and its result:

x  =  linspace(0,20,300);
y  =  exp((2-x)/5).*sin(x)+rand(x);
clf
plot2d(x,y)
e  =  gce();
e  =  e.children;
e.foreground  =  color("grey80");

d  =  diff(y)  ./  diff(x);
pmax  =  find(d(1:$-1)>=0  &  d(2:$)<0)+1;
pmin  =  find(d(1:$-1)<0  &  d(2:$)>0)+1;
// edges corrections
if  d(1)<0  then
     pmax  =  [1  pmax]
end
if  d($)<0  then
     pmin  =  [pmin  length(y)]
end
//
plot(x(pmax),y(pmax),"r",x(pmin),y(pmin),"b")


Zooming on that shows in some places the limits of this naive approach, 
to be refine.

Regards
Samuel


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20150424/09dd5f22/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jggihjdf.png
Type: image/png
Size: 46503 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20150424/09dd5f22/attachment.png>


More information about the users mailing list