# moving average filter

Started by December 16, 2012
```Sirs,

I have just started going through filter basics and the first filter topic
is moving average filter.

My understanding of a filter has always been that a part of the information
(can be noise or unwanted *information* in a certain context) gets removed.
By the same logic, the power of the signal gets reduced after filtering
process.

When I look at the moving average filter, it appears that as if noise, if
present, gets distributed across the nearby points, but nothing is
removed.

Am I correct?
if yes, is this the case with all the filters or this is the character of
only moving average filter alone?

Thanks, Manish
```
```On 12/16/12 1:04 AM, manishp wrote:
> Sirs,
>
> I have just started going through filter basics and the first filter topic
> is moving average filter.
>
> My understanding of a filter has always been that a part of the information
> (can be noise or unwanted *information* in a certain context) gets removed.
> By the same logic, the power of the signal gets reduced after filtering
> process.
>
> When I look at the moving average filter, it appears that as if noise, if
> present, gets distributed across the nearby points, but nothing is
> removed.
>
> Am I correct?
> if yes, is this the case with all the filters or this is the character of
> only moving average filter alone?
>

if you have a filter that is invertible, then no information is lost.

when a filter has frequency response (this would be the DTFT of the
impulse response of the filter) that goes to zero at any frequency, it
is not completely invertible.  this is because the inverse filter needs
to divide by zero to undo the multiplying by zero of the forward filter.

so, it might be that the simple moving-average filter loses some
information and it would be any periodic component with period equal to
the length of the aperture of the moving average filter (this length is
how many adjacent samples are averaged).  this periodic component is
*removed* by the moving-average filter and you'll never get it back.

sometimes it's hard to get the toothpaste back into the tube.
multiplying by zero is an operation you cannot undo.

--

r b-j                  rbj@audioimagination.com

"Imagination is more important than knowledge."

```
```manishp <58525@dsprelated> wrote:

> I have just started going through filter basics and the first filter topic
> is moving average filter.

> My understanding of a filter has always been that a part of the
> information (can be noise or unwanted *information* in a certain
> context) gets removed.

It would be nice if filters removed noise and left signal,
but that is rare.

> By the same logic, the power of the signal gets reduced
> after filtering process.

Consider an optical filter that transmits half the light that
hits it, and absorbs half.

> When I look at the moving average filter, it appears that as if
> noise, if present, gets distributed across the nearby points,
> but nothing is removed.

If light was continuous, then reducing the intensity by half
(or amplitude by sqrt(2)), nothing would be lost. You could,
ideally, increase the amplitude again. With a less than
ideal amplifier, you might add noise.

But light isn't continuous. You absorb, on average, half the
photons. If you reduce by half, and then double again, you have
lost, maybe just a little, information.

> Am I correct?
> if yes, is this the case with all the filters or this is the
> character of only moving average filter alone?

A moving average, adds some bins together and then divides
by the number of terms added. For quantized data, with a
quantized output, you lose a little information when you
divide and either truncate or round.

-- glen
```
```On Sun, 16 Dec 2012 00:04:58 -0600, manishp wrote:

> Sirs,
>
> I have just started going through filter basics and the first filter
> topic is moving average filter.
>
> My understanding of a filter has always been that a part of the
> information (can be noise or unwanted *information* in a certain
> context) gets removed.
> By the same logic, the power of the signal gets reduced after filtering
> process.
>
> When I look at the moving average filter, it appears that as if noise,
> if present, gets distributed across the nearby points, but nothing is
> removed.
>
> Am I correct?
> if yes, is this the case with all the filters or this is the character
> of only moving average filter alone?
>
> Thanks, Manish

The high frequencies get attenuated, but (except for a few specific
zeros) not removed entirely.

This is the case with all filters -- there will be zeros at some specific
(or no) frequencies, and otherwise information at "out of band"
frequencies will be suppressed, not removed.

--
Tim Wescott
Control system and signal processing consulting
www.wescottdesign.com
```
```>On Sun, 16 Dec 2012 00:04:58 -0600, manishp wrote:
>
>> Sirs,
>>
>> I have just started going through filter basics and the first filter
>> topic is moving average filter.
>>
>> My understanding of a filter has always been that a part of the
>> information (can be noise or unwanted *information* in a certain
>> context) gets removed.
>> By the same logic, the power of the signal gets reduced after filtering
>> process.
>>
>> When I look at the moving average filter, it appears that as if noise,
>> if present, gets distributed across the nearby points, but nothing is
>> removed.
>>
>> Am I correct?
>> if yes, is this the case with all the filters or this is the character
>> of only moving average filter alone?
>>
>> Thanks, Manish
>
>The high frequencies get attenuated, but (except for a few specific
>zeros) not removed entirely.
>
>This is the case with all filters -- there will be zeros at some specific

>(or no) frequencies, and otherwise information at "out of band"
>frequencies will be suppressed, not removed.
>
>--
>Tim Wescott
>Control system and signal processing consulting
>www.wescottdesign.com
>

The running average filter is good mainly for removing inband noise and is
best viewed in time domain as smooting filter. In frequency domain it is
not good as it has slow transition and its stopband is "wobbly" and not
that efficient.
Each sample is just the average of adjacent samples and so you can imagine
if one sample in the pipe(decided by number of taps) is
well different it will affect all values around.

Your thinking that a filter also attenuates power of signal is not right
with digital filters. You the designer control unity gain of your
passband.

Kadhiem
```