DSPRelated.com
Forums

Which is the cut -off frequency of Moving Average LP Filter?

Started by gpezzella December 22, 2011
Hello

in my previous post "Pass Band Filter: my first one" I have ask help for
design Pass Band Filter between this 2 frequency: 0.1Hz - 10Hz

Since the first frequency is almost zero, could I design low pass filter,
like Moving Average ?

In this case I have found this equation for cutoff FREQUENCY Fc

   Fc = (0.443 / Number of Point ) * Fsampling 

It is correct?

I know that more are the Number of Point, more good is the slope dB/Decade

Which is the exact correlation?

Thanks
On Dec 23, 4:48&#4294967295;am, "gpezzella" <gpezzella@n_o_s_p_a_m.yahoo.com>
wrote:
> Hello > > in my previous post "Pass Band Filter: my first one" I have ask help for > design Pass Band Filter between this 2 frequency: 0.1Hz - 10Hz > > Since the first frequency is almost zero, could I design low pass filter, > like Moving Average ? > > In this case I have found this equation for cutoff FREQUENCY Fc > > &#4294967295; &#4294967295;Fc = (0.443 / Number of Point ) * Fsampling > > It is correct? > > I know that more are the Number of Point, more good is the slope dB/Decade > > Which is the exact correlation? > > Thanks
What is the transfer function?
On 12/22/2011 7:48 AM, gpezzella wrote:
> Hello > > in my previous post "Pass Band Filter: my first one" I have ask help for > design Pass Band Filter between this 2 frequency: 0.1Hz - 10Hz > > Since the first frequency is almost zero, could I design low pass filter, > like Moving Average ? > > In this case I have found this equation for cutoff FREQUENCY Fc > > Fc = (0.443 / Number of Point ) * Fsampling > > It is correct? > > I know that more are the Number of Point, more good is the slope dB/Decade > > Which is the exact correlation? > > Thanks
"The exact correlation" is maybe a bit more complicated than you'd like. But here goes with a bit of an arm-waving approach: Consider this: A moving average is computed with: 1.0*x(n+k)+1.0*x(n-1+k)+1.0*x(n-2+k) ... 1.0*x(1+k) 1.0*x(k) / (n+1) So, the filter is a set of n+1 coefficients of 1.0 each and as many zeros as you like before and after. Consider that this is like an infinite series of samples of 1.0 that's windowed to include only n+1 samples. Roughly speaking, the Fourier Transform of the window is a sinc whose width varies inversely with the length of the window. The Fourier Transform of the n+1 samples is similar except it's a Fourier Transform of discrete samples and so will be periodic .. the periodicity is the transformation of a sinc to a Dirichlet which repeats at fs, 2fs, etc. such that the otherwise sinc "tails" overlap. The Discrete Fourier Transform of the same sequence is of course, discrete as well and will have a shape or envelope related to the sinc/Dirichlet. Since it's a sort of lowpass filter, the sinc/Dirichlet shape peaks at zero frequency. And, the larger is "n", the narrower the shape / the lower the cutoff frequency. You can express the function as a function of length in time (or "n") and get an exact expression. Fred
On 12/22/2011 10:48 AM, gpezzella wrote:
> Hello > > in my previous post "Pass Band Filter: my first one" I have ask help for > design Pass Band Filter between this 2 frequency: 0.1Hz - 10Hz > > Since the first frequency is almost zero, could I design low pass filter, > like Moving Average ? > > In this case I have found this equation for cutoff FREQUENCY Fc > > Fc = (0.443 / Number of Point ) * Fsampling > > It is correct? > > I know that more are the Number of Point, more good is the slope dB/Decade > > Which is the exact correlation?
The frequency response in the passband of a moving-average filter is rather bumpy and the cut-off isn't very sharp. The number of samples (points, as you call them) to get decent performance gives the filter a rather long latency. It is a poor choice for most purposes. 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;
On Thu, 22 Dec 2011 15:22:44 -0500, Jerry Avins wrote:

> On 12/22/2011 10:48 AM, gpezzella wrote: >> Hello >> >> in my previous post "Pass Band Filter: my first one" I have ask help >> for design Pass Band Filter between this 2 frequency: 0.1Hz - 10Hz >> >> Since the first frequency is almost zero, could I design low pass >> filter, like Moving Average ? >> >> In this case I have found this equation for cutoff FREQUENCY Fc >> >> Fc = (0.443 / Number of Point ) * Fsampling >> >> It is correct? >> >> I know that more are the Number of Point, more good is the slope >> dB/Decade >> >> Which is the exact correlation? > > The frequency response in the passband of a moving-average filter is > rather bumpy and the cut-off isn't very sharp. The number of samples > (points, as you call them) to get decent performance gives the filter a > rather long latency. It is a poor choice for most purposes.
You mean the frequency response in the stop band. It has a very poor rolloff/latency, as you mention. The one place where I find it to work very well indeed is where those (theoretically) infinitely deep nulls work in your favor more than the downsides. It's a great filter to use as an anti-alias between a fast ADC and a decimation step down to a slower control loop -- you just average the ADC readings over each control loop interval (or just sum, and adjust your gains elsewhere). This gives you about 1/2 a control sample's worth of excess delay, not too much amplitude rolloff in your control loop's bandwidth, and whopping deep nulls at all the frequencies that might alias into your loop's bandwidth. -- My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com
On 12/22/11 10:48 AM, gpezzella wrote:
> Hello > > in my previous post "Pass Band Filter: my first one" I have ask help for > design Pass Band Filter between this 2 frequency: 0.1Hz - 10Hz > > Since the first frequency is almost zero, could I design low pass filter, > like Moving Average ? > > In this case I have found this equation for cutoff FREQUENCY Fc > > Fc = (0.443 / Number of Point ) * Fsampling > > It is correct? >
alright, no one else is giving you a straight answer, and this is a well-defined question. a moving average filter is this FIR: { 1/L 0 <= n < L h[n] = { { 0 otherwise L is the "number of taps" (if implemented naively) or the length of the delay (if implemented as a CIC). it has a definite frequency response, and the -3.01 dB frequency (a.k.a. "half-power point") can be computed. H(w) = DTFT{ h[n] } L-1 = SUM{ 1/L * e^(-j*w*n) } n=0 L-1 = 1/L * SUM{ e^(-j*w*n) } n=0 1 - e^(-j*w*L) = 1/L --------------- 1 - e^(-j*w) e^(-j*w*L/2) e^(j*w*L/2) - e^(-j*w*L/2) = 1/L * ------------ * ---------------------------- e^(-j*w/2) e^(j*w/2) - e^(-j*w/2) = 1/L * e^(-j*w*(L-1)/2) * sin(w*L/2)/sin(w/2) you can see that in the limit as w->0 H(w) -> 1. now we want to know at what normalized angular frequency w that |H(w)|^2 = 1/2 . |H(w)|^2 = ( 1/L * sin(w*L/2)/sin(w/2) )^2 = 1/2 now, the icky part is that we have to solve this for the smallest w>0 that |H(w)|^2 = 1/2. and it will be non-simple function of L. if L is a large integer, then sin(w/2) is about w/2 for any frequency of interest. then this becomes sin(w*L/2)/(w*L/2) = sqrt(1/2) that happens when w*L is about 2.783113 or when w/(2*pi) = 0.442946/L . this is good only if L >> 1. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
On 12/22/2011 2:46 PM, robert bristow-johnson wrote:
> On 12/22/11 10:48 AM, gpezzella wrote: >> Hello >> >> in my previous post "Pass Band Filter: my first one" I have ask help for >> design Pass Band Filter between this 2 frequency: 0.1Hz - 10Hz >> >> Since the first frequency is almost zero, could I design low pass filter, >> like Moving Average ? >> >> In this case I have found this equation for cutoff FREQUENCY Fc >> >> Fc = (0.443 / Number of Point ) * Fsampling >> >> It is correct? >> > > alright, no one else is giving you a straight answer, and this is a > well-defined question. > > a moving average filter is this FIR: > > { 1/L 0 <= n < L > h[n] = { > { 0 otherwise > > > L is the "number of taps" (if implemented naively) or the length of the > delay (if implemented as a CIC). > > it has a definite frequency response, and the -3.01 dB frequency (a.k.a. > "half-power point") can be computed. > > > H(w) = DTFT{ h[n] } > > L-1 > = SUM{ 1/L * e^(-j*w*n) } > n=0 > > > L-1 > = 1/L * SUM{ e^(-j*w*n) } > n=0 > > > 1 - e^(-j*w*L) > = 1/L --------------- > 1 - e^(-j*w) > > e^(-j*w*L/2) e^(j*w*L/2) - e^(-j*w*L/2) > = 1/L * ------------ * ---------------------------- > e^(-j*w/2) e^(j*w/2) - e^(-j*w/2) > > > = 1/L * e^(-j*w*(L-1)/2) * sin(w*L/2)/sin(w/2) > > you can see that in the limit as w->0 H(w) -> 1. now we want to know at > what normalized angular frequency w that |H(w)|^2 = 1/2 . > > |H(w)|^2 = ( 1/L * sin(w*L/2)/sin(w/2) )^2 = 1/2 > > now, the icky part is that we have to solve this for the smallest w>0 > that |H(w)|^2 = 1/2. and it will be non-simple function of L. if L is a > large integer, then sin(w/2) is about w/2 for any frequency of interest. > then this becomes > > sin(w*L/2)/(w*L/2) = sqrt(1/2) > > that happens when w*L is about 2.783113 or when w/(2*pi) = 0.442946/L . > > this is good only if L >> 1. > >
Is there no respect for homework any more? And, you *assume*(?) -3dB is the definition of cutoff frequency for the OP? Fred
Thanks Robert, for this very useful post. I had the same question but with your clear explanation I had the answer programmed in Matlab in no time.