DSPRelated.com
Forums

Cut-off frequency of moving average filter

Started by Rockerboy December 7, 2007
Hi all,

I have a simple question. What is the cut-off frequency of a 7-point
moving average filter?

I am able to successfully do low-pass and high-pass filtering using
the moving average algorithm. I just want to know what my cut-off
frequency will be.

Thanks,
Abhishek
"Rockerboy" <rkabhi@gmail.com> wrote in message 
news:da79037c-4d5c-4f41-88b9-77280c5cb9ae@i29g2000prf.googlegroups.com...
> Hi all, > > I have a simple question. What is the cut-off frequency of a 7-point > moving average filter? > > I am able to successfully do low-pass and high-pass filtering using > the moving average algorithm. I just want to know what my cut-off > frequency will be.
Roughly it will be one-half the reciprocal of the length of the filter (measured in time - or around 7/fs. I don't know how you turn a 7-point average into a high pass though... Fred
On Dec 7, 11:14 pm, "Fred Marshall" <fmarshallx@remove_the_x.acm.org>
wrote:
> "Rockerboy" <rka...@gmail.com> wrote in message > > news:da79037c-4d5c-4f41-88b9-77280c5cb9ae@i29g2000prf.googlegroups.com... > > > Hi all, > > > I have a simple question. What is the cut-off frequency of a 7-point > > moving average filter? > > > I am able to successfully do low-pass and high-pass filtering using > > the moving average algorithm. I just want to know what my cut-off > > frequency will be. > > Roughly it will be one-half the reciprocal of the length of the filter > (measured in time - or around 7/fs. > > I don't know how you turn a 7-point average into a high pass though...
subtract the output of the 7-point average from a delayed (by (7-1)/2 samples) input. r b-j
On 8 Des, 05:14, "Fred Marshall" <fmarshallx@remove_the_x.acm.org>
wrote:
> "Rockerboy" <rka...@gmail.com> wrote in message > > news:da79037c-4d5c-4f41-88b9-77280c5cb9ae@i29g2000prf.googlegroups.com... > > > Hi all, > > > I have a simple question. What is the cut-off frequency of a 7-point > > moving average filter? > > > I am able to successfully do low-pass and high-pass filtering using > > the moving average algorithm. I just want to know what my cut-off > > frequency will be. > > Roughly it will be one-half the reciprocal of the length of the filter > (measured in time - or around 7/fs. > > I don't know how you turn a 7-point average into a high pass though...
Modulate it with cos(pi*n). In practice, that means flicking the sign of every other sample in the LP. Rune
Rune Allnor wrote:
> On 8 Des, 05:14, "Fred Marshall" <fmarshallx@remove_the_x.acm.org> > wrote: >> "Rockerboy" <rka...@gmail.com> wrote in message >> >> news:da79037c-4d5c-4f41-88b9-77280c5cb9ae@i29g2000prf.googlegroups.com... >> >>> Hi all, >>> I have a simple question. What is the cut-off frequency of a 7-point >>> moving average filter? >>> I am able to successfully do low-pass and high-pass filtering using >>> the moving average algorithm. I just want to know what my cut-off >>> frequency will be. >> Roughly it will be one-half the reciprocal of the length of the filter >> (measured in time - or around 7/fs. >> >> I don't know how you turn a 7-point average into a high pass though... > > Modulate it with cos(pi*n). In practice, that means > flicking the sign of every other sample in the LP.
That's a low-pass, but not necessarily the same low pass. An interesting side note: If one adds the digits of a number n, the result is nMOD(base - 1) + x*(base - 1) where x can be any integer. In base 10, this is called "casting out nines". It provides a quick check when doing arithmetic by hand. If one alternately adds and subtracts the digits, the result is nMOD(base - 1) + x*(base + 1) In base 10, this casts out elevens. If a calculation passes both these checks, there's only a one percent chance of undetected error. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
"robert bristow-johnson" <rbj@audioimagination.com> wrote in message 
news:68b85efa-e239-4240-9919-2f6b35550512@d4g2000prg.googlegroups.com...
> On Dec 7, 11:14 pm, "Fred Marshall" <fmarshallx@remove_the_x.acm.org> > wrote: >> "Rockerboy" <rka...@gmail.com> wrote in message >> >> news:da79037c-4d5c-4f41-88b9-77280c5cb9ae@i29g2000prf.googlegroups.com... >> >> > Hi all, >> >> > I have a simple question. What is the cut-off frequency of a 7-point >> > moving average filter? >> >> > I am able to successfully do low-pass and high-pass filtering using >> > the moving average algorithm. I just want to know what my cut-off >> > frequency will be. >> >> Roughly it will be one-half the reciprocal of the length of the filter >> (measured in time - or around 7/fs. >> >> I don't know how you turn a 7-point average into a high pass though... > > subtract the output of the 7-point average from a delayed (by (7-1)/2 > samples) input. > > r b-j >
Assuming all unit coefficients, all that does is flip the sign of the output and zero the center coefficient. ???? Fred
"Jerry Avins" <jya@ieee.org> wrote in message 
news:Od2dnQlmofVEL8fanZ2dnUVZ_sytnZ2d@rcn.net...
> Rune Allnor wrote: >> On 8 Des, 05:14, "Fred Marshall" <fmarshallx@remove_the_x.acm.org> >> wrote: >>> "Rockerboy" <rka...@gmail.com> wrote in message >>> >>> news:da79037c-4d5c-4f41-88b9-77280c5cb9ae@i29g2000prf.googlegroups.com... >>> >>>> Hi all, >>>> I have a simple question. What is the cut-off frequency of a 7-point >>>> moving average filter? >>>> I am able to successfully do low-pass and high-pass filtering using >>>> the moving average algorithm. I just want to know what my cut-off >>>> frequency will be. >>> Roughly it will be one-half the reciprocal of the length of the filter >>> (measured in time - or around 7/fs. >>> >>> I don't know how you turn a 7-point average into a high pass though... >> >> Modulate it with cos(pi*n). In practice, that means >> flicking the sign of every other sample in the LP. > > That's a low-pass, but not necessarily the same low pass. >
Looks like a highpass to me! f(nT)=[1 -1 1 -1 1 -1 1] n=0:6 peaks its response at fs/2. Highpass.... Fred
On Dec 9, 12:39 am, "Fred Marshall" <fmarshallx@remove_the_x.acm.org>
wrote:
> "robert bristow-johnson" <r...@audioimagination.com> wrote in message > > news:68b85efa-e239-4240-9919-2f6b35550512@d4g2000prg.googlegroups.com... > > > > > On Dec 7, 11:14 pm, "Fred Marshall" <fmarshallx@remove_the_x.acm.org> > > wrote: > >> "Rockerboy" <rka...@gmail.com> wrote in message > > >>news:da79037c-4d5c-4f41-88b9-77280c5cb9ae@i29g2000prf.googlegroups.com... > > >> > Hi all, > > >> > I have a simple question. What is the cut-off frequency of a 7-point > >> > moving average filter? > > >> > I am able to successfully do low-pass and high-pass filtering using > >> > the moving average algorithm. I just want to know what my cut-off > >> > frequency will be. > > >> Roughly it will be one-half the reciprocal of the length of the filter > >> (measured in time - or around 7/fs. > > >> I don't know how you turn a 7-point average into a high pass though... > > > subtract the output of the 7-point average from a delayed (by (7-1)/2 > > samples) input. > > Assuming all unit coefficients,
no, a moving *average* has all coefs equal to 1/N (in this case N=7). a moving *average* (not moving sum) filter has a DC gain of 0 dB.
> all that does is flip the sign of the output > and zero the center coefficient. ????
what it does is have all coefs = 1/7, except the center coef is -6/7. that's a sorta high pass filter. at least there is a zero at DC (z=1) and the gain increases from DC to a max at z = e^(j*2*pi/7) (and then i think it starts to decrease again. so i guess this is something like a comb filter. it's just that i often think of moving average filters as LPF. r b-j
On Dec 9, 12:12 am, robert bristow-johnson <r...@audioimagination.com>
wrote:
> On Dec 9, 12:39 am, "Fred Marshall" <fmarshallx@remove_the_x.acm.org> > wrote: > > > > > > > "robert bristow-johnson" <r...@audioimagination.com> wrote in message > > >news:68b85efa-e239-4240-9919-2f6b35550512@d4g2000prg.googlegroups.com... > > > > On Dec 7, 11:14 pm, "Fred Marshall" <fmarshallx@remove_the_x.acm.org> > > > wrote: > > >> "Rockerboy" <rka...@gmail.com> wrote in message > > > >>news:da79037c-4d5c-4f41-88b9-77280c5cb9ae@i29g2000prf.googlegroups.com... > > > >> > Hi all, > > > >> > I have a simple question. What is the cut-off frequency of a 7-point > > >> > moving average filter? > > > >> > I am able to successfully do low-pass and high-pass filtering using > > >> > the moving average algorithm. I just want to know what my cut-off > > >> > frequency will be. > > > >> Roughly it will be one-half the reciprocal of the length of the filter > > >> (measured in time - or around 7/fs. > > > >> I don't know how you turn a 7-point average into a high pass though... > > > > subtract the output of the 7-point average from a delayed (by (7-1)/2 > > > samples) input. > > > Assuming all unit coefficients, > > no, a moving *average* has all coefs equal to 1/N (in this case N=7). > > a moving *average* (not moving sum) filter has a DC gain of 0 dB. > > > all that does is flip the sign of the output > > and zero the center coefficient. ???? > > what it does is have all coefs = 1/7, except the center coef is -6/7. > that's a sorta high pass filter. at least there is a zero at DC (z=1) > and the gain increases from DC to a max at z = e^(j*2*pi/7) (and then > i think it starts to decrease again. so i guess this is something > like a comb filter. it's just that i often think of moving average > filters as LPF. > > r b-j- Hide quoted text - > > - Show quoted text -
I implemented the high-pass filter by multiplying the coefficients by [1, -1, 1, -1, 1, -1, 1]. Will the cutoff be the same for the high-pass filter as well? Thanks, Abhishek
Usually, the cutoff frequency is defined as the frequency of -3dB
(half-power) point.

DigitalSignal
Website: www.go-ci.com