Sunday, February 26, 2017

Low Pass FIR Filter



I want to design FIR low-pass filter with the following specifications:


 Cut-off frequency: 200 Hz 


Order: 20

Sampling frequency: 1000 Hz

what should be the stepwise method to do so



Answer



Your filter is highly under-specified, so I assume that your design is supposed to be very basic. A very basic method would be to simply truncate and shift the impulse response of an ideal low pass filter with cutoff frequency $\omega_c=2\pi f_c/f_s=0.4\pi$ (where $f_s$ is the sampling frequency):


$$h_{ideal}(n)=\frac{\sin(\omega_c n)}{\pi n}$$


Note that since your filter must be causal you need to shift and truncate the ideal impulse response such that it is symmetric with respect to its maximum:



$$h(n)=\frac{\sin(\omega_c (n-10))}{\pi (n-10)},\quad n=0,1,\ldots,20\tag{1}$$


Equation (1) gives you the 21 filter coefficients $h(n)$ of a causal FIR filter approximating an ideal low pass filter response. Note that the filter order is 20.


A simple Matlab/Octave code could look like this:


n = -10:10;
omc = 0.4*pi; % normalized cut-off frequency in rad
h = sin(omc*n)./(pi*n); % impulse response
h(11) = omc/pi; % correct NaN value at n=0
H = fft(h,1024); % complex frequency response
f = 1000/1024*(0:512); % FFT frequency grid up to fs/2
plot(f,abs(H(1:513))); % plot magnitude of frequency response

No comments:

Post a Comment

periodic trends - Comparing radii in lithium, beryllium, magnesium, aluminium and sodium ions

Apparently the of last four, $\ce{Mg^2+}$ is closest in radius to $\ce{Li+}$. Is this true, and if so, why would a whole larger shell ($\ce{...