Are you agreed that for a fixed filter's shape means fixed: cutoff frequency and width of transition band, the order of digital FIR filter depends upon the sampling frequency? As in the book scientists and engineers guide to digital signal processing by Steven W. Smith, he states that a rough estimation of the FIR filter's order in case of window (Hamming, Black man,...) implementation can be made as: Filter order = 4 /Normalised width of transition band. Can you suggest me some more accurate method to estimate the order of FIR filter depending upon the sampling frequency as long as the shape of filter is fixed. Thanks in advance for the tips. Renaudin

# How to calculate the order (parameters) of an FIR filter Optimally

Started by ●August 11, 2006

Reply by ●August 11, 20062006-08-11

renaudin wrote:> Are you agreed that for a fixed filter's shape means fixed: cutoff > frequency and width of transition band, the order of digital FIR filter > depends upon the sampling frequency?No, I don't agree with that. True, I am splitting hairs now, but one is usually given a sampling frequency, then chooses cut-off requencies etc, and have to find a filter order that makes everything work. The difference from what you said is subtle: The way you phrased your statement might give the impression that one may decide on a filter order and then choose a sampling frequency. It is the other way around.> As in the book scientists and engineers guide to digital signal processing > by Steven W. Smith, he states that a rough estimation of the FIR filter's > order in case of window (Hamming, Black man,...) implementation can be > made as: > > Filter order = 4 /Normalised width of transition band.Yep, finding the order if FIR filters is not at all an exact science.> Can you suggest me some more accurate method to estimate the order of FIR > filter depending upon the sampling frequency as long as the shape of > filter is fixed.There were a few papers on some experimental results about how to estimate filter orders in the Parks-McClellan algorithm. I *think* Rabiner was one of the authors, but I am not sure. These papers ought to have been published some time in the early/mid '70s. Rune

Reply by ●August 11, 20062006-08-11

"renaudin" <alsaeed86@gmail.com> wrote in message news:NbGdnWyK4r7a-UHZnZ2dnUVZ_vednZ2d@giganews.com...> Are you agreed that for a fixed filter's shape means fixed: cutoff > frequency and width of transition band, the order of digital FIR filter > depends upon the sampling frequency? > > As in the book scientists and engineers guide to digital signal processing > by Steven W. Smith, he states that a rough estimation of the FIR filter's > order in case of window (Hamming, Black man,...) implementation can be > made as: > > Filter order = 4 /Normalised width of transition band. > > Can you suggest me some more accurate method to estimate the order of FIR > filter depending upon the sampling frequency as long as the shape of > filter is fixed. > > Thanks in advance for the tips. > > RenaudinMitra's book Handbook for Digital Signal Processing quotes Kaiser with a simple estimate: N = [-20*log10(sqrt(dp*ds)) - 13]/[14.6(ws - wp)/2pi] where dp and ds are the passband ripple peak and stopband ripple peak values, ws and wp are the stopband and passband edges - which are normalized to 2pi as you can see (where 2pi==fs). So, N is a direct function of the ripple peaks and an inverse function of the normalized transition band width) If dp and ds are both 0.01 and (ws-wp)/2pi = 0.1 then: N = [-20*log10(sqrt(10^-4)) -13]/[1.46] = [-20*-2 -13]/1.46 = 27/1.46 = 18.5 or, rounded up, 19. The rough rule I usually use is that the reciprocal of the transition band width is no less than the filter length in time (which is N/fs) .. if one expresses the transition band width in Hz. N*(1/FS) = 1/(fs - fp) where FS is the sampling frequency and fs is the stop band edge. Note that this is really independent of the sampling rate because it expresses length in terms of time. Where the sampling rate comes in is when it's chosen and directly affects the number of samples in the filter impulse response. For the same situation, choosing FS=1kHz, fs=400Hz and fp= 300Hz: N = FS/(fs - fp) = 1000/(100) = 10 So, it looks like I've been off by a factor of 2 and should say: N*(1/FS) = 2/(fs - fp) N = 2*FS/(fs-fp) = 20 Of course, this can be normalized to FS so it's "independent" of FS (tho not): If one is satisfied with a *fractional* transition band specification, then the filter length is independent of sample rate. In that case, if the sample rate goes up, so does the transition band width. So, part of the answer depends on the filter specification - is it expressed in Hz or are the band edges / transition width expressed in percent of total bandwidth / sample rate? As Kaiser's formula points out, the order is related to the passband and stopband errors as well. So this approximation is for the *minimum* length. And, if you assume that a symmetrical FIR filter (linear phase filter) requires roughly twice as many coefficients then 4*FS/(fs-fp) might be a reasonable approximation for a *minimum* length. I think the real power of all this is in estimating a filter's likely length before going to a lot of trouble to design a filter that you don't want / can't use because the specifications push the length to be too large. But then, designing filters isn't all that hard any more and I've always been satisfied to just see what comes out - even if I have to iterate on the length to get what I want. One figures out pretty quickly if the filter is going to be too long. Fred

Reply by ●August 11, 20062006-08-11

renaudin wrote:> Are you agreed that for a fixed filter's shape means fixed: cutoff > frequency and width of transition band, the order of digital FIR filter > depends upon the sampling frequency? > > As in the book scientists and engineers guide to digital signal processing > by Steven W. Smith, he states that a rough estimation of the FIR filter's > order in case of window (Hamming, Black man,...) implementation can be > made as: > > Filter order = 4 /Normalised width of transition band. > > Can you suggest me some more accurate method to estimate the order of FIR > filter depending upon the sampling frequency as long as the shape of > filter is fixed.Why do you want to know? Is your thirst for knowledge practical or theoretical?. In any case, the recipes for turtle soup and filters begin similarly. It's either "First, catch a turtle" or "First, pick a sample rate." There are several good estimators for filter length, all of them heuristic. If your interest is theoretical, you might ask Grant Griffin which ones he uses and why. If it is practical, just get his ScopeFIR at http://www.iowegian.com/ and let the program estimate it for you while calculating the coefficients. (Avoid http://www.gothic-iowegian.com/) Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������

Reply by ●August 11, 20062006-08-11

renaudin wrote:> Are you agreed that for a fixed filter's shape means fixed: cutoff > frequency and width of transition band, the order of digital FIR filter > depends upon the sampling frequency?1. passband corner frequency (cutoff) 2. transition band width there are other parameters, most notably the stop-band attenuation and possible the passband ripple. but, given a particular filter shape in log frequency (so the shape of the filter is already determined, which means that the ratio of like dimensioned quantities are constant - i.e. transition BW to passband corner frequency), then the effective length of the impulse response, in units of time, is inversely proportional to corner frequency and the number of taps needed for the FIR will be equal to the product of that impulse response length and the sampling frequency. how to calculate the order needed in an FIR to do a particular job (that is the performance parameters: passband corner frequency, transition band width, stop-band attenuation, etc. are pre-determined and fixed) depends on the type or "family" of FIR filter you're designing. the top candidates usually are windowed inverse DFT (often using the Kaiser window), Parks-McClellan algorithm (often called "remez"), and least-squares fit. they all have different heuristic fomulaes for your initial guess at the FIR length. you make that guess, use the computer to design your filter, check the frequency response to see if it satisfies your requirements and, if not, lengthen the FIR length and repeat or, if your requirements are way more than satisfied, shorten the FIR length (checking the result after you do this) and get fewer taps to get the job done. that's the only way i really know how to optimally design the FIR length. i s'pose it can be automated and somebody has likely done that, but i haven't. r b-j