DSPRelated.com
Forums

about deciding the order of the fir filter,,

Started by rashmi venugopal January 13, 2011
On Jan 14, 4:46&#4294967295;am, Chris Bore <chris.b...@gmail.com> wrote:
> > Kaiser's empirical formula for estimating the order of a filter: > > &#4294967295; &#4294967295; DeltaF =(FilterSpec.StopBand - FilterSpec.PassBand) / > FilterSpec.FilterRate; > > &#4294967295; &#4294967295; NoOfFilterCoefficients = 2 * (int) (FilterSpec.Attenuation - 8) / > (29 * DeltaF) + 1;
okay, we got DeltaF spelled out. it's the same as my (PB+SB)/SR. how is your Attenuation spec defined? is it dB? the negative of my SBG (stopband gain)? does the "ripple" or whatever error in the passband go into this with Kaiser? doesn't appear so. if my assumption about FilterSpec.Attenuation is correct, then comparing Kaiser window to Parks-McClellan it's Kaiser: deltaF*(N-1)/2 = -(1/29)*SBG - 8/29 = -0.0344828*SBG - 0.275862 Parks-McC: deltaF*(N-1)/2 = -0.0171208*SBG - 0.445141 - 0.342416*log10(10^(PBR/40)-1) that last term (for the passband ripple) goes away only if PBR is about 12 dB (which is ridiculous). otherwise, comparing the two, it appears that Kaiser is about twice as sensitive to stop band attenuation than is P-McC. that maybe makes some sense, the less- optimized Kaiser needs more taps than the optimized P-McC for the same stopband attenuation. r b-j
On Jan 14, 12:08&#4294967295;am, robert bristow-johnson
<r...@audioimagination.com> wrote:
> On Jan 13, 10:41&#4294967295;pm, Fred Marshall <fmarshall_xremove_the...@xacm.org> > wrote: > > > > > I probably get it wrong by a factor of 2 now and then but here's how I > > think about it: > > > Let's design a filter using the windowing method. > > Let's start with a rectangular window. > > This means that we convolve the Desired Frequency Response with a sinc > > that corresponds to the rectangular window length. > > I note that the rectangular window isn't *great* as a window in the > > windowing method BUT the rectangular window has the narrowest main lobe > > in the corresponding FT - the sinc above. > > > So, when we convolve with *that* particular sinc, brick wall transitions > > end up about as wide as the main lobe of the sinc. > > The width of the main lobe is a direct function of the length of the > > filter and about 2X the distance between zeros in the sinc as the main > > lobe takes two of those intervals. &#4294967295;The intervals are 1/NT where NT is > > the length of the filter. &#4294967295;So the transition regions can't be less than > > 2/NT. > > yes, this explains why the number of FIR taps must be inversely > proportional to the width of the transition band of the LPF. &#4294967295;those > other terms in that equation having to do with the magnitude of > ripples in the passband and stopband, that is harder for me to figger > out why. and the funny constants that go with them is not clear to > me. &#4294967295;without the rounding: > > (N-1)/2 = (-0.342416*log10(10^(PBR/40)-1) - 0.0171208*SBG - 0.4451408)/ > ((SB-PB)/SR) > > PBR and SBG are in dB. &#4294967295;if i convert them to the more natural Nepers, > it's > > (N-1)/2 = (-0.14870938*ln(e^(PBR/2)-1) - 0.14870938*SBG - 0.4451408)/ > ((SB-PB)/SR) > > ((SB-PB)/SR) is the normalized transition band width. &#4294967295;now that it's > in "natural units", where do the numbers 0.14870938 and 0.4451408 come > from? &#4294967295;it must be from a heuristic or from some optimized fit. &#4294967295;it > looks like there's about a factor of 3 relating the two. > > even if we scale it by 2*pi (so that the transition band is measure in > the natural units of the DTFT) we get numbers like 0.93436859 and > 2.796902134. so i really don't know where the special constants come > from. &#4294967295;the only thing that makes natural sense is that the normalized > ((SB-PB)/SR) is in the denominator. > > r b-j
From what I have seen in the literature - the development of the equations for PM filter orders was done heuristically. The formulas you see generally work, or they give you a place to start from. The formulas encounter problems when the transition bands approach the band ends i.e f=0 or f=0.5 (for real signals and assuming f_samp =1). With respect to interpretation you can think of the stopband and passband ripples as affecting the slope in the transition width portion of the filter - which in turn drives the length of the filter. With this interpretation - it is really the last passband ripple and first stopband ripple which determine the slope (i.e. the ripples closest to the transition width). For windowed sinc type of filter design - If I recall correctly - the kaiser window is the only one that lends itself to the prediction of the sidelobe levels. With the other type windows it is more or less trial and error to get specific sidelobe levels. Hope that helps. Cheers, David
sir,, i am rashmi,, i am doing Mtech project,, i need to design a filter to
measure the Total Harmonic Distortion in meters, 
so i have selected the FIR filter ,, while designing the FIR filter, how to
choose the window function, i mean rect, hamming, hanning, etc,, how to
select the accurate one, which method or formula to apply 
On Jan 17, 6:50&#4294967295;am, Dave <dspg...@netscape.net> wrote:
...
> > For windowed sinc type of filter design - If I recall correctly - the > kaiser window is the only one that lends itself to the prediction of > the sidelobe levels. With the other type windows it is more or less > trial and error to get specific sidelobe levels. > > Hope that helps. > Cheers, > David
Any parameterized window family with a region of well behaved sidelobes can be used to tabulate filter parameters vs window parameters. Kaiser has done so for the Io Bessel window and published an approximation formula. Others have done so for Saramaki and ultraspherical window filter design.I expect that others have also been published. A simple table can be generated for many windows to provide a range of solutions. Dale B. Dalrymple