title:Calculate fir coefficients with C keywords:c,linux,fir,dsp,octave # Calculate fir coefficients with C ## Intro FIR filter's is probably ones of fascinating parts when you want to do with DSP, its kind of too simple from first glance and they works. As before I have learned about FIR and IIR and was able to use them just from tools that take as input parameters and give as output coefficients. Now time came just to calculate FIR from ground up. Also C is perfect to do stuff without abstraction levels hiding details, and can be ported to other languages and platforms. Lets calculate filter coefficients with windows method. Theory is not explained, there is a lot of playlists on youtube and lecture notes online to check on that. ## Implementation Low pass ideal impulse response Ideal impulse response for low-pass filter $$2f_c\frac{sin(n \omega_c)}{n \omega_c}$$ ```c for (i=0;i-1.0E-5 && x < 1.0E-5) return (1.0); return sin(x)/x; } ``` Rectangular window for low pass filter ```c for (i=0;i