Thanks porten! Thanks Bitstream!

But our professor has said that design your own filter!(not used built in function of matlab).

I am designing my own filter.The problem is still there.First, i have to know filter's order(N). One way is to find from its transition width. The pass-band edge frequency is 500Hz and stop band edge frequency is 700Hz. But i don't understand how to get it? Can you help me?

  • $\begingroup$ What is the sample rate? $\endgroup$
    – Jim Clay
    Dec 18 '13 at 15:30
  • $\begingroup$ Hello, and welcome to DSP.se. Would you mind improving the quality of your question a little bit? The question is not really clear the way it is written, also adding some more details could help. And please, try to stay on point and only explain your problem, what you have tried, and your question. You can find examples of good questions here. To modify your question, you can always edit it. $\endgroup$
    – penelope
    Dec 19 '13 at 12:06

There is no one perfect order "N". You can always get a better (or at least as good) filter by increasing N, at the cost of more computational load. So usually the question is "what is the lowest N that will be barely good enough?"

A relatively easy way to determine that is experimentally. Guess what you think the optimal N will be, design a filter, see if it meets the filter criteria or not. If it does with large margins, reduce N by a lot. If it barely makes it either stop or reduce N by a little. If it doesn't make the criteria, increase N. Rinse and repeat.

frederic harris (for some reason he likes to have his name uncapitalized) gave the following formula in his book "Multirate Signal Processing for Communication Systems":

$ N \approx \frac{f_s}{\Delta f} \frac{Atten(dB) - 8}{14}$

where $N$ is the estimated filter order, $f_s$ is the sample frequency, $\Delta f$ is the transition band width, and $Atten(dB)$ is the amount of attenuation you want in the stop band, in dB. I would not use the formula to get the optimal $N$, rather I would use it as a starting place for the iterative process described above.


Kaiser's approximation is another way to do this and it seemed to work better, at least in my case:

N = [-20*log10(sqrt(dp*ds)) - 13]/[14.6(ws - wp)/2pi]


Oppenheim and schaefer p 480 - Characteristics of FIR filters, which is also Kaiser's approximation

Another option is Belanger's approximation, from the first reference.

These are only estimates and in practice, these will be good for a first estimate but you will then have to iteratively look at the graphs and adjust N manually if you need to get a good fit.


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