DSPRelated.com
Forums

How do digital filters know the frequency ?

Started by Unknown May 6, 2005
Hi,

How do the digital filters (FIR or IIR) know how to reject or accept
frequency content ?

Ex : A real world signal after digitization passing through the digital
filters could be having many frequency components. So, how does the
filter know the frequency content when it only deals with samples ???
Where does that frequency content hidden in the digital filters ??

Thanks
Sandeep

sandeep_mc81@yahoo.com writes:

> Hi, > > How do the digital filters (FIR or IIR) know how to reject or accept > frequency content ? > > Ex : A real world signal after digitization passing through the digital > filters could be having many frequency components. So, how does the > filter know the frequency content when it only deals with samples ??? > Where does that frequency content hidden in the digital filters ??
Sandeep, The samples you speak of are only one way to "represent" a signal. Another way to represent a signal is with "frequencies" (I'm speaking loosely here, comp.dsp folk). The filter was designed to operate on samples by knowing what it does to the frequencies. -- Randy Yates Sony Ericsson Mobile Communications Research Triangle Park, NC, USA randy.yates@sonyericsson.com, 919-472-1124
Randy Yates <randy.yates@sonyericsson.com> writes:

> sandeep_mc81@yahoo.com writes: > > > Hi, > > > > How do the digital filters (FIR or IIR) know how to reject or accept > > frequency content ? > > > > Ex : A real world signal after digitization passing through the digital > > filters could be having many frequency components. So, how does the > > filter know the frequency content when it only deals with samples ??? > > Where does that frequency content hidden in the digital filters ?? > > Sandeep, > > The samples you speak of are only one way to "represent" a signal. Another > way to represent a signal is with "frequencies" (I'm speaking loosely here, > comp.dsp folk). The filter was designed to operate on samples by knowing what > it does to the frequencies.
I should add that the filter itself can also be represented as "samples" or "frequencies." By looking at the filter as "frequencies" you will see what it does to the frequencies in the samples it processes. In fact there is a theorem in DSP that allows us to know this is true, called the "Convolution theorem" or the "Convolution property of the Fourier transform." It states that processing a signal with a filter in time is the same as multiplying the signal frequencies by the filter frequencies. Hopefully this helps rather than confuses... -- Randy Yates Sony Ericsson Mobile Communications Research Triangle Park, NC, USA randy.yates@sonyericsson.com, 919-472-1124
Sandeep

I think of it this way...a digital filter does not work in frequency,
it works in time.
But there is a relationship between time and frequency.

Take a simple digital filter where you take the last three samples and
add them together and divide by three.  This is just a simple average
and it creates a kind of low pass filter.

A more complex digital filter, instead of added the three  samples
equally, assigns a specific weighting or coefficient to each one and
can have many more than 3.  These are the so called  taps or
coefficients.  By the proper selection (using some magic math to figure
them out)  of these weightings or tap coefficients you can create any
frequency (and phase) response that you want.

Mark

<sandeep_mc81@yahoo.com> wrote in message
news:1115382935.964134.20960@g14g2000cwa.googlegroups.com...
> > How do the digital filters (FIR or IIR) know how to reject or accept > frequency content ? > > Ex : A real world signal after digitization passing through the digital > filters could be having many frequency components. So, how does the > filter know the frequency content when it only deals with samples ??? > Where does that frequency content hidden in the digital filters ??
I assume you are looking for an intuitive rather than mathematical explanation, so that's what I will attempt. Think of a signal that after being sampled repeats itself every 10 samples. If you look at the samples, you can a pattern that repeats every 10 samples, and that is how the frequency is represented or "hidden" in the samples. Now to filter that frequency, imagine a filter that looked at groups of 10 samples and did some math on them, maybe an average, or a subtraction, or something more complex. By looking at groups of 10 samples and doing the math on them, the filter can affect that particular frequency in a unique way. Here's another filter example, a little more detailed this time. Consider a very high frequency signal, one that repeats every 2 samples (say the samples are 1, -1, 1, -1...). This is the highest frequency that can be represented by the samples. Now imagine you do a simple two point "moving average" filter, in other words, for every point, the output is the average of the last 2 samples (just add them up and divide by 2). With our signal, the output would be zero. This filter, which just averages every 2 samples, has completely removed the high frequency signal! Now imagine that the same filter was applied to a very low frequency signal. With a low frequency signal, each sample is almost the same value as the previous sample, for example: 1, 0.99, 0.98, 0.97, 0.96.... In this case, the moving average filter does almost nothing to the signal--what comes out is almost exactly what went in. So this filter, which completely killed the high frequency signal, does not affect the low frequency signal much at all! If you want to go further, imagine that the moving average was changed to a subtraction, i.e. each output was the difference of the previous 2 samples divided by 2 instead of the sum divided by 2. Now how would it affect the high and low frequency signals discussed above? Hope this helps a little! Best wishes in your understanding of DSP. -- Jon Harris SPAM blocked e-mail address in use. Replace the ANIMAL with 7 to reply.
sandeep_mc81@yahoo.com wrote:

> Hi, > > How do the digital filters (FIR or IIR) know how to reject or accept > frequency content ?
They don't, any more or less than the Earth knows how to move around the Sun. They just follow some mathematical laws and passing or rejecting signals at certain frequencies is the result.
> > Ex : A real world signal after digitization passing through the digital > filters could be having many frequency components. So, how does the > filter know the frequency content when it only deals with samples ??? > Where does that frequency content hidden in the digital filters ?? > > Thanks > Sandeep >
I think you have three misconceptions. The first is that the filter has frequency information explicit in the parameters -- it doesn't. The filter parameters determine how it works, but you have to do some math to figure it out. The second is that a filter "accepts" or "rejects" certain frequencies -- it doesn't. It only accepts a signal, and it outputs a processed signal that is determined by the input and the filter characteristics. The relationship between the output and input is a time-domain one, the frequency domain is just a useful (highly useful!) mathematical abstraction that helps us understand what's going on in the time domain. Finally you seem to think that the "acceptance" or "rejection" is arbitrary and clear-cut -- it isn't. A filter cannot pass 100% of a certain range of frequencies and block 100% of another range of frequencies, at least not without either being non-causal or having infinite delay. Filters _must_ pass a little bit of all frequencies, with the exception of notch filters which can be made to reject exactly one spot frequency for each pair of filter states you're willing to add. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
sandeep_mc81@yahoo.com wrote:
> Hi, > > How do the digital filters (FIR or IIR) know how to reject or accept > frequency content ? > > Ex : A real world signal after digitization passing through the digital > filters could be having many frequency components. So, how does the > filter know the frequency content when it only deals with samples ??? > Where does that frequency content hidden in the digital filters ??
As log as we agree that neither circuits nor programs "know" anything, we can use your anthropomorphic terms. You can't filter a single sample. Digital filters operate in time, but time and frequency are related. By processing at a single time samples taken at different times, the amplitude of the result can depend on frequency. The simplest example I can think of at the moment -- I hope others will outdo me there -- is an FIR filter with two coefficients: +1, -1, fed with a swept sinewave (an excellent way to probe its response). At very low frequencies, adjacent samples are nearly equal, and their difference is very small. As the frequency increases, the difference between adjacent samples increases, therefore also the response. At Fs/4, one sampling is +1, 0, -1, 0, ... and the response is 100%. (It drops off after that.) Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Jerry Avins wrote:
> sandeep_mc81@yahoo.com wrote: > >> Hi, >> >> How do the digital filters (FIR or IIR) know how to reject or accept >> frequency content ? >> >> Ex : A real world signal after digitization passing through the digital >> filters could be having many frequency components. So, how does the >> filter know the frequency content when it only deals with samples ??? >> Where does that frequency content hidden in the digital filters ?? > > > As log as we agree that neither circuits nor programs "know" anything, > we can use your anthropomorphic terms. > > You can't filter a single sample. Digital filters operate in time, but > time and frequency are related. By processing at a single time samples > taken at different times, the amplitude of the result can depend on > frequency. > > The simplest example I can think of at the moment -- I hope others will > outdo me there -- is an FIR filter with two coefficients: +1, -1, fed > with a swept sinewave (an excellent way to probe its response). At very > low frequencies, adjacent samples are nearly equal, and their difference > is very small. As the frequency increases, the difference between > adjacent samples increases, therefore also the response. At Fs/4, one > sampling is +1, 0, -1, 0, ... and the response is 100%. (It drops off > after that.) >
A filter with transfer function 1 - z^{-1} will respond strongest to Fs/2; you are thinking of a filter with transfer function 1 - z^{-2} -- which does have two nonzero coefficients, but I bet that's not what you were thinking. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
Tim Wescott wrote:

   ...

> A filter with transfer function 1 - z^{-1} will respond strongest to > Fs/2; you are thinking of a filter with transfer function 1 - z^{-2} -- > which does have two nonzero coefficients, but I bet that's not what you > were thinking.
I was thinking of processing a sample train of +1, 0, -1, 0, +1, 0, -1, 0, ... with the two-tap FIR with tap values of +1 and -1. That gives the output train +1, +1, -1, -1, +1, +1, -1, -1, which exceeds unity -- I erred there -- but I believe is a maximum. Is it larger elsewhere? Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Jerry Avins wrote:
> Tim Wescott wrote: > > ... > >> A filter with transfer function 1 - z^{-1} will respond strongest to >> Fs/2; you are thinking of a filter with transfer function 1 - z^{-2} >> -- which does have two nonzero coefficients, but I bet that's not what >> you were thinking. > > > I was thinking of processing a sample train of +1, 0, -1, 0, +1, 0, -1, > 0, ... with the two-tap FIR with tap values of +1 and -1. That gives the > output train +1, +1, -1, -1, +1, +1, -1, -1, which exceeds unity -- I > erred there -- but I believe is a maximum. Is it larger elsewhere? > > Jerry
Well, a sample train of +1, -1, +1, -1, ... would give you +2, -2, +2, -2, ... -- Tim Wescott Wescott Design Services http://www.wescottdesign.com