No BSD License  

Highlights from
slidingavg

3.6

3.6 | 5 ratings Rate this file 22 Downloads (last 30 days) File Size: 4.68 KB File ID: #1967
image thumbnail

slidingavg

by Michele Giugliano

 

16 Jul 2002 (Updated 17 Jul 2002)

One-dimensional sliding-window arithmetic average of a signal.

| Watch this File

File Information
Description

This function implements a one-dimensional smoothing filter, applying a sliding window to a numerical sequence. Such filtering replaces the center value in the window with the arithmetic mean computed among the points within the window.

When the sliding window is exceeding the lower or upper boundaries of the input vector, the average is computed only among the available points.
 
This function can be conveniently employed for smoothing one-dimensional noisy signals and its results are very similar to other "quick and dirty" smoothing techniques.
When compared to a standard first-order low-pass filter, it is important to note that the averaging performed here does not only involve the past history of the signal but the future samples as well.

I underline that the filtering by the present routine resembles what the median filter performs (see medfilt1()), although there is no "artifact" or transient responses at the beginning and the end of the signal, due to the presence of a non-zero offset in the data (see the screenshot).

MATLAB release MATLAB 6.1 (R12.1)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (5)
01 Nov 2002  
25 Aug 2003 todd mackey

Inefficient and limited to 1D data only. Should use summed area tables.

25 Feb 2004 Jan Mikkelsen

Well written .. and very usefull

31 Oct 2006 K K  
24 Nov 2006 Siony Cole

Used to use this file. Now, i find the fast moving_average.m by carlos vargas, works with nans, and for matrix too... anyway, thanks michele

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
dsp Michele Giugliano 22 Oct 2008 06:46:34
signal processing Michele Giugliano 22 Oct 2008 06:46:34
median filtering Michele Giugliano 22 Oct 2008 06:46:34
average Michele Giugliano 22 Oct 2008 06:46:34
sliding window Michele Giugliano 22 Oct 2008 06:46:34
sliding window vignesh kannan 20 Apr 2010 03:34:58
average vignesh kannan 20 Apr 2010 03:35:01
dsp vignesh kannan 20 Apr 2010 03:35:03
median filtering vignesh kannan 20 Apr 2010 03:35:06
signal processing vignesh kannan 20 Apr 2010 03:35:08
sliding window Lior 19 Apr 2011 12:02:27
average Lydie 13 Jun 2011 11:23:14
signal processing Yasmine 08 Sep 2011 09:59:12
sliding window Christian 16 Sep 2011 08:15:55

Contact us at files@mathworks.com