Low pass FIR Filter Design
LordIlpolazzo
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 coefficients 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/MercurySwitchFilter/FIR.html
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
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 coefficients 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/MercurySwitchFilter/FIR.html
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
4
answers
Last reply
More about pass filter design

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. 
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. 
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
Related Resources
Ask a new question
Read More
Filter
Formula
Related Resources
 NEW MOBO LOW FPS INGAME (MSI NEO2 FIR P45)
 Fractal Design Define R5's bottom filter question
 solved H440 front fan filter makes fan make a low rurring noise
 solved Using a passive 2way crossover as a low cut filter
 Fractal Design R3 fan filter replacement...
 solved Low pass mark score i5 4690k
 solved Lynnfield i5 750, Can I pass 3.6 GHz with low voltage?
 Low Latency WLAN network design
 CPU USAGE LOW, GPU USAGE SPIKES  low FPS (firs time)
 Looking for a low budget Design/Gaming display.
 solved Low budget build for design/media
 solved Building a low budget PC for Graphic Design
 solved Double Check or Help Design my Low Power Gaming Rig on a Budget.
 solved Which low noise fans are compatible with Fractal Design R4's front fan position(s)?
 solved Help design Low Power computer/server to be on 24x7. Uses Subsonic music server and NAS?
See also
 solved Power Efficiency & EMI: Low EMI, DIGI+ VRM, Digital Power Design
 My HP with Intel Q 8200 scores low with Pass Mark Performance 7.0
 Any dust filters I can use for the Fractal Design Define S
 Pinnacle Studio AV vs. PassThrough on LowEnd Canon miniDV
 solved Tower case  Quiet, low temp and dust filters