help-octave
[Top][All Lists]
Advanced

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

Re: averaging/smoothing data


From: Dmitri A. Sergatskov
Subject: Re: averaging/smoothing data
Date: Wed, 13 Jul 2016 12:10:28 -0500

On Wed, Jul 13, 2016 at 11:58 AM, Przemek Klosowski <address@hidden> wrote:

[sorry for repost: maybe my original post gave an impression that I am not asking seriously, but I think it's an important and frequent use case, so here it is again]


Often, I need to smooth/average a data vector. I usually do a running average using filter(), e.g. for 5-value average:

    filter(ones(1:5)/5,eye(5,1),x)

I've been doing this for years, so I got used to it even though I have to think a little every time I need to do again, but maybe there's a better way? What do y'all use?



By the way, sometimes I'd use a Savitzky-Golay peak/moment-preserving filter coefficients instead of a simple rectangular averaging window:


# Copyright (C) 1993 Przemek Klosowski ; licensed under GPL
#
# You should have received a copy of the GNU General Public License
# along with Octave; see the file COPYING.  If not, write to the Free
# Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

function retval = savgol (m,nl,nr)




​There are also sgolay and agolayfilt in signal package.​
 

Dmi​tri.
--





reply via email to

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