help-octave
[Top][All Lists]
Advanced

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

Re: matlab code for filter


From: Ben Abbott
Subject: Re: matlab code for filter
Date: Wed, 04 Feb 2009 07:09:47 -0500


On Feb 4, 2009, at 6:01 AM, frederic manseau wrote:

Hi,

I found this Matlab code for filtering data which is supposed to do a Local regression using weighted linear least squares and a 1st degree polynomial model.

pethsmooth=smooth(x,50,'rloess');%%%%%%this uses a Matlab function 'rloess' to smooth the data based on how ever number of points you want belowzero=pethsmooth<0;%%%%%% this detects points below zero (you can't have a negative firing rate) pethsmooth(belowzero)=0; %%%%this sets all those <0 points to 0 in the smoothed PETH

Would anyone know if it’s possible to adapt this so that it can be used in Octave?


Thank you for your help,

Frederic Manseau

I assume smooth() is part of MathWorks Curve Fitting Toolbox?

http://www.mathworks.com/access/helpdesk/help/toolbox/curvefit/index.html?/access/helpdesk/help/toolbox/curvefit/smooth.html&http://www.google.com/search ?client=safari&rls=en-us&q=matlab+smooth&ie=UTF-8&oe=UTF-8

As far as I can tell there is no non-proprietary implementation that includes the "rloess' option.

If a moving average is sufficient, you might try applying the function below.

        
http://www.koders.com/matlab/fidF98C4038125ED2B735FD1A470193BE6D0527537C.aspx

The one below uses splines

        
http://www.koders.com/matlab/fid4EB3DAE35400131296D09E63B306CB1A01624579.aspx?s=Chebyshev

I haven't tried any of these, so I can't attest to their capabilities.

The two lines below, will run fine in Octave.

belowzero=pethsmooth<0;
pethsmooth(belowzero)=0;

It would be easier (and I think clearer) to write

        pethsmooth (pethsmooth<0) = 0;

Ben


reply via email to

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