Sign in with
Sign up | Sign in
Your question

Low pass FIR Filter Design

Tags:
  • Filter
  • Formula
Last response: in Work & Education
Share
May 21, 2009 7:06:15 PM

Hi,

This question is for the electronic engineering types amongst you; any advice would be much appreciated..

So the problem; I am trying to undesrtand how to apply the following formula to calculate the co-efficients for a low pass FIR filter like so:

What i mean this this:
C(n) = (Sin( n * pi * (Fc/Fn)) ) / (pi * n)
Where Fc = Cuttoff frequency, Fn = Nyquist frequency, i.e. Half the sampling frequency, and n = The filter tap you wish yo calculate.

I have found an example on the web whihc explains it, see link:
http://homepages.which.net/~paul.hills/Circuits/Mercury...

The problem is I cannot see how they get from that formula to the final values for the filter taps they show; the formula seems to give the same answer regardless of the value for n, like this:

Taking the example in the link above...
Fc = 1Hz, Fs = 16Hz therefore Fn = 8Hz, applying:

C(n) = (Sin( n * pi * (Fc/Fn)) ) / (pi * n)

For n=-2:
C(n) = (Sin( -2 * pi * (1/8)) ) / (pi * -2) = 0.00218

For n=-1:
C(n) = (Sin( -1 * pi * (1/8)) ) / (pi * -1) = 0.00218

For n=0:
C(n) = (Sin( 0 * pi * (1/8)) ) / (pi * 0) = calculator says "Math Error" this is just plan wrong

For n=1:
C(n) = (Sin( 1 * pi * (1/8)) ) / (pi * 1) = 0.00218

For n=2:
C(n) = (Sin( 2 * pi * (1/8)) ) / (pi * 2) = 0.00218

See the problem? I assume I am misunderstanding something at a very fundamental level, but I have no idea what. I have not applied the hamming window correction formula to the results above, but in all cases the adjustment was in the range of 0.99999 which dosent alter the final filter tap values much... Any help would be greatly appreciated

More about : low pass fir filter design

May 22, 2009 2:39:33 PM

First, I know nothing about electronic engineering so don't expect to much, but I was rather good at maths (lots of it as part of my software engineering degree).

IMO, the problem is simply radians/degrees conversion. Most common calculators (including the Windows one) interpret the input of the sin() function as degrees, but the presence of PI in the formula leads me to believe it should be radians. Try your formula in Excel (the sin function uses radians, not degrees) if you have it. Otherwise, you can always try to replace PI by 180 in the sin function like this:
C(n) = (Sin( n * 180 * (Fc/Fn)) ) / (pi * n)

Oh, and n must be different than 0 or you will have a division by 0 which is a mathematical error.

Let me know if it solved your problem.
m
0
l
May 22, 2009 6:57:25 PM

Hi,

Thanks for taking a look; that's sorted it out, thank you! I repeated all the calculations in radians mode (both the ones in my post above, and the hamming windows ones which I didn't show) rather than degrees and sure enough things come out prety close to what they should be. It turns out that n(0) is a special case; there is seperate formula for this which is C(0) = 2Fc. I havent been able to get that to work though.

I now get

(-2) tap = 0.019
(-1) tap = 0.082
(0) tap = ... still trying to sort that one out
(1) tap = 0.082
(2) tap = 0.019

Which strangely is not exactly what is on the web site in the link, perhaps there are some errors in that site since I have applied the radians approach to some other examples of this type of problem I have and it works perfectly.

m
0
l
Related resources
January 17, 2011 12:46:39 PM

Sorry I never replied, I just received a notification of your reply ... talk about late.

Did you ever fixed your issue?
m
0
l
March 31, 2012 12:13:08 PM

That was easy, it is 1/8 or 0.125

1. Easy answer :

when you get limit of SIN(x)/x where x converges to 0 you get 1 . It does not matter whether you converge from minus side or plus side, therefore this is a continuous function. ( in other words there is no divide_by_zero= +/- infinite situation )


2. Hardcore mathematical answer :

When you open up SIN(x) function into Taylor series you get

x**1 / 1! - x**3 / 3! + x**5 / 5! - x**7 / 7! + x**9 / 9! - x**11 / 11! + x**13 / 13! ............

Put "n*pi/8" instead of "x" to the series above, then simplify the equation by dividing it by "n*pi" , and then apply 0 instead of "n", you get 1/8
m
0
l
!