1
$\begingroup$

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

$\endgroup$

closed as off-topic by jojek, lennon310, Jason R, Peter K. May 13 '14 at 12:35

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "General programming questions are off-topic here, but can be asked on Stack Overflow." – lennon310, Peter K.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ Which software do you use? Or do you need to do this by hand? Note that your specs are very general and for this reason many methods are possible. $\endgroup$ – Matt L. Apr 28 '14 at 19:58
  • $\begingroup$ using matlab but not but in funtions $\endgroup$ – farhan Apr 28 '14 at 20:21
  • $\begingroup$ So you cannot use any functions of the Signal Processing Toolbox? $\endgroup$ – Matt L. Apr 28 '14 at 20:25
  • $\begingroup$ No, I cannot use any of the function from signal processing tool box. $\endgroup$ – farhan Apr 28 '14 at 20:28
5
$\begingroup$

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
$\endgroup$
  • $\begingroup$ @farhan: You're welcome! If you feel that your question has been answered satisfactorily, you can accept it by hitting the 'accept' button next to the answer. $\endgroup$ – Matt L. Apr 29 '14 at 18:16
  • $\begingroup$ there are options of active and oldest no option of accept any where $\endgroup$ – farhan Apr 29 '14 at 18:43
  • $\begingroup$ can u help me if I wanted to draw a filter using rectangular window? $\endgroup$ – farhan Apr 29 '14 at 18:58
  • $\begingroup$ @farhan: There's a checkmark on the top left of the answer. What do you mean exactly by "draw a filter using rectangular window"? Make a plot of its frequency response? $\endgroup$ – Matt L. Apr 29 '14 at 19:38
  • $\begingroup$ Yes, I really want that code $\endgroup$ – farhan Apr 29 '14 at 20:44

Not the answer you're looking for? Browse other questions tagged or ask your own question.