PDA

View Full Version : Relation between length of a filter and number of taps


vasindagi
06-28-2008, 06:18 AM
Hi All,
I have been trying to figure out the relation between length of a fi
filter and its number of taps. I found a discussion in this forum itsel
which was in 2005 which is similar to this question but the discussion di
not give the answer.
Thanks

Rune Allnor
06-28-2008, 08:03 AM
On 28 Jun, 07:18, "vasindagi" <[email protected]> wrote:
> Hi All,
> I have been trying to figure out the relation between length of a fir
> filter and its number of taps. I found a discussion in this forum itself
> which was in 2005 which is similar to this question but the discussion did
> not give the answer.
> Thanks

Try this simple experiment. You can easily do the
maths with pen and paper, no need for computers:

1) Use the FIR filter function h[n] = [1,1]
2) Convolve this with the delayed Kronecker delta
function d[n] = [0,1,0,0,0,0,0]. This convolution
can easily be done by hand.
3) How many coefficients in the impulse response are
non-zero?
4) Repeat 1-3 with the impulse response h[n] =[1,1,1].
5) Can you see a relation between the number of non-zero
coefficients in the FIR filter and the number of
non-zero coefficients in the impulse response?

Rune

bharat pathak
06-28-2008, 08:07 AM
>Hi All,
>I have been trying to figure out the relation between length of a fir
>filter and its number of taps. I found a discussion in this forum itself
>which was in 2005 which is similar to this question but the discussio
did
>not give the answer.
>Thanks

Typically,

Length of FIR filter = Number of Taps = Number of Coefficients.

and

Order of FIR filter = Number_of_coefficients - 1; // true only for FIR

now the above 2 equations are valid for cases like

h(n) = [h0 h1 h2 h3 h2 h1 h0]

num_of_coeff = 7;
order = 6;

//--------------------------------------------------------------------

but in some cases u might come across filters like

h(n) = [h0 0 0 0 0 0 h0];

now this is where the confusion will arise.

one approach is to treat this as 2 tap filter, because only
2 valid taps are there rest of them are "0's". but this is
incorrect convention.

again in this case the filter can still be though as having
7 coefficients or taps and whose middle coefficients are all zeros.
and the order being 6.

//------------------------------------------------------------------

The confusion element comes from the fact that the large number o
coefficients does not necessarily mean the filter will occupy huge
area or will take lot of computation cycles. It maybe well the case
that center coefficients could be zero.

//------------------------------------------------------------------

All this does not matter much as long as you understand where you
are headed to and what is your interpretation.

Hope I made my point clear.

Thanks and Regards

Bharat Pathak

Arithos Designs
www.Arithos.com

A Premier DSP Design Consultancy and Corporate Training Company.

vasindagi
06-28-2008, 10:48 AM
>>Hi All,
>>I have been trying to figure out the relation between length of a fir
>>filter and its number of taps. I found a discussion in this foru
itself
>>which was in 2005 which is similar to this question but the discussion
>did
>>not give the answer.
>>Thanks
>
>Typically,
>
>Length of FIR filter = Number of Taps = Number of Coefficients.
>
>and
>
>Order of FIR filter = Number_of_coefficients - 1; // true only for FIR
>
>now the above 2 equations are valid for cases like
>
>h(n) = [h0 h1 h2 h3 h2 h1 h0]
>
>num_of_coeff = 7;
>order = 6;
>
>//--------------------------------------------------------------------
>
>but in some cases u might come across filters like
>
>h(n) = [h0 0 0 0 0 0 h0];
>
>now this is where the confusion will arise.
>
>one approach is to treat this as 2 tap filter, because only
>2 valid taps are there rest of them are "0's". but this is
>incorrect convention.
>
>again in this case the filter can still be though as having
>7 coefficients or taps and whose middle coefficients are all zeros.
>and the order being 6.
>
>//------------------------------------------------------------------
>
>The confusion element comes from the fact that the large number of
>coefficients does not necessarily mean the filter will occupy huge
>area or will take lot of computation cycles. It maybe well the case
>that center coefficients could be zero.
>
>//------------------------------------------------------------------
>
>All this does not matter much as long as you understand where you
>are headed to and what is your interpretation.
>
>Hope I made my point clear.
>
>Thanks and Regards
>
>Bharat Pathak
>
>Arithos Designs
>www.Arithos.com
>
>A Premier DSP Design Consultancy and Corporate Training Company.
>
>
>
>
>
Hi Bharath,
Thanks a lot. I wanted to know the relation cos lot of sites said that th
FIR filter delay is (N-1)/2 where N is the number of taps. So I wanted t
know how N is related to the length of the filter.

Thanks

Rick Lyons
06-29-2008, 03:56 PM
On Sat, 28 Jun 2008 04:48:09 -0500, "vasindagi" <[email protected]>
wrote:

>>>Hi All,
>>>I have been trying to figure out the relation between length of a fir
>>>filter and its number of taps. I found a discussion in this forum
>itself
>>>which was in 2005 which is similar to this question but the discussion
>>did
>>>not give the answer.
>>>Thanks
>>
(snipped by Lyons]
>>
>Hi Bharath,
>Thanks a lot. I wanted to know the relation cos lot of sites said that the
>FIR filter delay is (N-1)/2 where N is the number of taps. So I wanted to
>know how N is related to the length of the filter.
>
>Thanks

Hi,
To keep myself out of trouble, I always think of
tapped-delay line FIR filters, whose coefficients
are real-valued and symmetrical, as having:

(1) an "Order" equal to the number of delay elements, and
(2) the group delay of the filter is Order/2,
measured in "samples."

The above two items are true regardless of the number
of coefficients (which may be very different from the
number of delay elements, a comb filter for example),
or the coefficients' values (many of which may be
zero-valued).

When you talk about "length of a fir filter and its
number of taps" the word "length" is a bit vague.
Better to use the word "order". Also, when ya'
talk about "number of taps" it's probably better
to say "number of non-zero coefficients."

The language is a bit inconsistent. For example, what
is called a "31-tap half-band FIR filter" has only
17 taps coming of the delay line. So how many
"taps" does this filter have? You make the call.
Better to call this a "30th-order half-band FIR
filter" (because its z-domain transfer function
is a 30th-order polynomial).

Ya' want another complication? Some FIR filters
are implemented with feedback, which makes them
recursive. (Tapped-delay line FIR filters are
strictly nonrecursive.)

Sheece. I wonder if the above helped, or not.

[-Rick-]

Fred Marshall
06-30-2008, 02:49 PM
"Rick Lyons" <R.Lyons@_BOGUS_ieee.org> wrote in message
news:[email protected]...
> On Sat, 28 Jun 2008 04:48:09 -0500, "vasindagi" <[email protected]>
> wrote:
>
>>>>Hi All,
>>>>I have been trying to figure out the relation between length of a fir
>>>>filter and its number of taps. I found a discussion in this forum
>>itself
>>>>which was in 2005 which is similar to this question but the discussion
>>>did
>>>>not give the answer.
>>>>Thanks
>>>
> (snipped by Lyons]
>>>
>>Hi Bharath,
>>Thanks a lot. I wanted to know the relation cos lot of sites said that the
>>FIR filter delay is (N-1)/2 where N is the number of taps. So I wanted to
>>know how N is related to the length of the filter.
>>
>>Thanks
>
> Hi,
> To keep myself out of trouble, I always think of
> tapped-delay line FIR filters, whose coefficients
> are real-valued and symmetrical, as having:
>
> (1) an "Order" equal to the number of delay elements, and
> (2) the group delay of the filter is Order/2,
> measured in "samples."
>
> The above two items are true regardless of the number
> of coefficients (which may be very different from the
> number of delay elements, a comb filter for example),
> or the coefficients' values (many of which may be
> zero-valued).
>
> When you talk about "length of a fir filter and its
> number of taps" the word "length" is a bit vague.
> Better to use the word "order". Also, when ya'
> talk about "number of taps" it's probably better
> to say "number of non-zero coefficients."
>
> The language is a bit inconsistent. For example, what
> is called a "31-tap half-band FIR filter" has only
> 17 taps coming of the delay line. So how many
> "taps" does this filter have? You make the call.
> Better to call this a "30th-order half-band FIR
> filter" (because its z-domain transfer function
> is a 30th-order polynomial).
>
> Ya' want another complication? Some FIR filters
> are implemented with feedback, which makes them
> recursive. (Tapped-delay line FIR filters are
> strictly nonrecursive.)
>
> Sheece. I wonder if the above helped, or not.
>
> [-Rick-]

Rick's description is right on.

You have to be careful about using the term "length". Do you mean length in
time? or do you mean length measured in some hardware/software
implementation sense?

If it's length is time and if you assume that the first coefficient has zero
delay then the length in time would be N-1 wouldn't it? This would be the
same as the "order".

If it's length in hardware/software based on counting coefficients (er ...
delays plus 1) then N=length. That's the length that Parks-McClellan used.

Fred