DSPRelated.com
Forums

Filter Question

Started by Srikanth July 6, 2006
Hi

I have a really basic question regarding digital filters.. mite seem
dumb, but I couldn't figure it out. Anyway, here it is:

When we make a digital filter, we sample the time domain (for digital)
and in frequency domain, we get a convolution with a impulse train. So,
suppose I make a lowpass digital filter. If i have my sampling
frequency as F, and I take the gain at 0Hz as 0dB, and since suppose i
use a Bilateral Transform to avoid aliasing, I still get a series of
peaks (at 0, F, 2F etc, after the convolution).
My question is this - supposing my analog input has frequencies F, 2F
etc, wont it be let through? How is this lowpass at all? It works in
the sense that from 0 to F/2 Hz, 0 to f1 Hz (f1 based on design) is let
through, and f1 to F/2 is blocked, but again at frequencies where the
peaks occur will be let through right? How can i prevent this in
digital filters apart from choosing heigher and heigher sampling
frequencies so that my peaks are farther apart?

Of course,here i haven't considered the sampling of the frequency
domain to get a 'real' digital filter, but it shud be periodic
sampling, so i guess that doesn't matter...?

Thanks
Srikanth.

Srikanth wrote:
> Hi > > I have a really basic question regarding digital filters.. mite seem > dumb, but I couldn't figure it out. Anyway, here it is: > > When we make a digital filter, we sample the time domain (for digital) > and in frequency domain, we get a convolution with a impulse train. So, > suppose I make a lowpass digital filter. If i have my sampling > frequency as F, and I take the gain at 0Hz as 0dB, and since suppose i > use a Bilateral Transform to avoid aliasing, I still get a series of > peaks (at 0, F, 2F etc, after the convolution).
After sampling an analog-domain filter rresponse, this is correct, yes.
> My question is this - supposing my analog input has frequencies F, 2F > etc, wont it be let through? How is this lowpass at all?
There is a difference between analog domain and discrete-time domain. Your argument is utterly correct: In discrete time one can not see the difference between a smpled DC and a sampled sinusoidal at frequency F. This is the reason why people insist on using anti-alias analog filters. The anti-alias filters are there to ensure that what the discrete-time domain DC component equals the analog-time DC component.
> It works in > the sense that from 0 to F/2 Hz, 0 to f1 Hz (f1 based on design) is let > through, and f1 to F/2 is blocked, but again at frequencies where the > peaks occur will be let through right? How can i prevent this in > digital filters apart from choosing heigher and heigher sampling > frequencies so that my peaks are farther apart?
Analog anti-alias filters. Rune
Srikanth wrote:
> Hi > > I have a really basic question regarding digital filters.. mite seem > dumb, but I couldn't figure it out. Anyway, here it is: > > When we make a digital filter, we sample the time domain (for digital) > and in frequency domain, we get a convolution with a impulse train. So, > suppose I make a lowpass digital filter. If i have my sampling > frequency as F, and I take the gain at 0Hz as 0dB, and since suppose i > use a Bilateral Transform to avoid aliasing, I still get a series of > peaks (at 0, F, 2F etc, after the convolution). > My question is this - supposing my analog input has frequencies F, 2F > etc, wont it be let through? How is this lowpass at all? It works in > the sense that from 0 to F/2 Hz, 0 to f1 Hz (f1 based on design) is let > through, and f1 to F/2 is blocked, but again at frequencies where the > peaks occur will be let through right? How can i prevent this in > digital filters apart from choosing heigher and heigher sampling > frequencies so that my peaks are farther apart?
Useful sampling requires the sampling frequency to be greater than twice the bandwidth of the signal being sampled. When a signal includes DC, that is twice the highest frequency in the signal. To ensure the absence of components as high ass half the sampling frequency, an analog anti-alias filter is usually used between the signal source and the signal. When this is done, the higher frequencies around F, 2F, and so forth can be removed by an analog reconstruction filter. Before D-to-A conversion -- while the signal is still numbers -- those higher frequencies remain, but don't interfere.
> Of course,here i haven't considered the sampling of the frequency > domain to get a 'real' digital filter, but it shud be periodic > sampling, so i guess that doesn't matter...?
I don't see what you have in mind here. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Hi

> Analog anti-alias filters.
That was what I thought of, but it seems kind of inelegant (if I may say so). I am implementing a digital filter, but for it to work properly, I need an analog filter, and of a high order if I want a good response. I was hoping to find a method to avoid that... And while the sampling frequency must be heigher than twice the maximum frequency, I was considering background noise or things like that, that where i cant help higher frequency components coming in. Thanks Srikanth
Srikanth wrote:
> Hi > >> Analog anti-alias filters. > > That was what I thought of, but it seems kind of inelegant (if I may > say so). I am implementing a digital filter, but for it to work > properly, I need an analog filter, and of a high order if I want a good > response. I was hoping to find a method to avoid that...
Sampling rate and analog filter order are under the designers control. If the sample rate is high enough, a simple R-C analog filter will do. For a given application, there will be tolerable amount of aliasing and a required bandwidth. The process of design combines all if them.
> And while the sampling frequency must be heigher than twice the maximum > frequency, I was considering background noise or things like that, that > where i cant help higher frequency components coming in.
Do you mean background noise in the analog signal? That too passes through the anti-alias filter. It seems to me that your analysis is based on some assumptions that aren't entirely valid. If you state them explicitly, we might be able to guide you to a clearer picture. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Hi

> Sampling rate and analog filter order are under the designers control. > If the sample rate is high enough, a simple R-C analog filter will do.
I seem to be having some problem understanding this. I use the analog filter for the analog input (before I sample the sequence) right? And my transfer function for an RC filter is a kind of trapezoid..? So, how does my sampling frequency change my transfer function of the filter? Even if I have a heigher sampling frequency, my filter stage transfer function is still the same. The closer to a brick-wall type of filter I want, the heigher the order must be..? Could you please explain this? I guess it might be obvious, but I'm having some difficulty in this.
> Do you mean background noise in the analog signal? That too passes > through the anti-alias filter.
Actually, I mentioned background noise as a problem in case I don't have an anti-aliasing analog filter. In which case, frequencies heigher than 1/2 my sampling frequency might be present (in form of noise). I was just considering a theoretical case... I haven't made any assumptions (or if I have, it is accidental and I am unaware of it...) Thanks a lot Srikanth
Srikanth wrote:
> Hi > > > Sampling rate and analog filter order are under the designers control. > > If the sample rate is high enough, a simple R-C analog filter will do. > > I seem to be having some problem understanding this. I use the analog > filter for the analog input (before I sample the sequence) right?
Right.
> And > my transfer function for an RC filter is a kind of trapezoid..? So, how > does my sampling frequency change my transfer function of the filter?
It doesn't. Setting a high sampling frequency Fs (compared to the bandwidth B of the signal you want to sample) means your analog anti alias filter can be very simple/low order. If you push the limit, B -> Fs/2 you gain a slower ADC at the expense of a more complicated anti alias filter.
> Even if I have a heigher sampling frequency, my filter stage transfer > function is still the same. The closer to a brick-wall type of filter I > want, the heigher the order must be..?
Right. Jerry turns this argument "upside down" in order to get away with an as simple analog filter as possible.
> Could you please explain this? I guess it might be obvious, but I'm > having some difficulty in this. > > > Do you mean background noise in the analog signal? That too passes > > through the anti-alias filter. > Actually, I mentioned background noise as a problem in case I don't > have an anti-aliasing analog filter. In which case, frequencies heigher > than 1/2 my sampling frequency might be present (in form of noise).
These are two different problems. Noise is present in the data regardless of the anti alias filter. There *may* be ways to get rid of baseband noise from the digitized signal. Aliasing destroys all such hopes. hence you need the anti alias filter.
> I was just considering a theoretical case... I haven't made any > assumptions (or if I have, it is accidental and I am unaware of it...)
Your considerations in your first post were correct. You just failed to reach the correct conclusion. There *are* ambiguities in the signal for the very reasons you found. The way to get rid of them is to pre-process, if you like, the signal to ensure that the signal energy in the digitized signal originates in the analog frequency bands you think the originate in. That's a very roundabout way to say that you need an anti alias analog filter. You may think it isn't elegant. That's one opinion. The anti alias filter is, however, necessary. Rune
Srikanth wrote:
> Hi > >> Sampling rate and analog filter order are under the designers control. >> If the sample rate is high enough, a simple R-C analog filter will do. > > I seem to be having some problem understanding this. I use the analog > filter for the analog input (before I sample the sequence) right? And > my transfer function for an RC filter is a kind of trapezoid..? So, how > does my sampling frequency change my transfer function of the filter? > Even if I have a heigher sampling frequency, my filter stage transfer > function is still the same. The closer to a brick-wall type of filter I > want, the heigher the order must be..? > Could you please explain this? I guess it might be obvious, but I'm > having some difficulty in this. > >> Do you mean background noise in the analog signal? That too passes >> through the anti-alias filter. > Actually, I mentioned background noise as a problem in case I don't > have an anti-aliasing analog filter. In which case, frequencies heigher > than 1/2 my sampling frequency might be present (in form of noise). > > I was just considering a theoretical case... I haven't made any > assumptions (or if I have, it is accidental and I am unaware of it...)
Starting at the end, once the signal is sampled and reproduced, there are no frequencies higher than half the sampling rate. Frequencies that were originally higher are "reflected" about half the sampling frequency and appear below it as aliases. Examples: Sample a pure tone of 4.1 KHz at a rate of 8 KHz. Reproduce. The result is a 3.9 KHz alias. Sample a pure tone of 5 KHz at a rate of 8 KHz. Reproduce. The result is a 3 KHz alias. Sample a pure tone of 6 KHz at a rate of 8 KHz. Reproduce. The result is a 2 KHz alias. The anti-alias filter must attenuate frequencies above half the sampling frequency to acceptably low levels. It is theoretically possible to sample a 4 KHz signal at 8 KHz, but the necessary anti-alias filter id not feasible. When sampling at 10 KHz, the filter must still pass 4 KHz, but it needs to make negligible only those frequencies above 6 KHz if an additional digital filter is applied after the sampling. It works like this: Frequencies below 5 KHz don't create aliases. Those from 5 to 6 KHz create aliases from 5 to 4 KHz. A digital filter can remove those aliases without impairing the desired signal. If we can sample the 4-KHz signal at 20 KHz, then the anti-alias filter can allow through frequencies up to 16 KHz and subsequent digital filtering can still provide a clean signal. It may be that no physical filter is needed at all if the signal source is a cheap microphone, and in any event, two octaves is a generous transition band. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Srikanth wrote:

> Hi > > >>Sampling rate and analog filter order are under the designers control. >>If the sample rate is high enough, a simple R-C analog filter will do. > > > I seem to be having some problem understanding this. I use the analog > filter for the analog input (before I sample the sequence) right? And > my transfer function for an RC filter is a kind of trapezoid..? So, how > does my sampling frequency change my transfer function of the filter? > Even if I have a heigher sampling frequency, my filter stage transfer > function is still the same. The closer to a brick-wall type of filter I > want, the heigher the order must be..? > Could you please explain this? I guess it might be obvious, but I'm > having some difficulty in this. >
Just in case Rune's and Jerry's explanations don't gell: Take as an example a communications-quality audio signal. It goes from 0Hz to 3kHz and you need a signal to noise ratio of 72dB (4000:1). By my calculations* sampling your audio at 8kHz (telephone standard) would require a 14th-order anti aliasing filter to pound the alias from 5kHz down to 1/4000 of it's former value while still passing 3kHz. On the other hand, if you were to sample at 1MHz you would only need a 2nd-order filter to get the alias down that far -- and it could be implemented as a passive cascade of resistors and caps. Before you get bent out of shape at sampling at 1MHz, by the way -- that's what sigma-delta converters do, with internal digital filtering and decimation before you read the value. * Could someone check my math? This seems excessive. I'm assuming a Butterworth filter to make the math easier -- I imagine a Chebychev or an elliptic could do much better. Does anyone know what the telco's actually used back in the days of 88mH inductors? -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Posting from Google? See http://cfaj.freeshell.org/google/ "Applied Control Theory for Embedded Systems" came out in April. See details at http://www.wescottdesign.com/actfes/actfes.html
Tim Wescott wrote:

   ...

> * Could someone check my math? This seems excessive. I'm assuming a > Butterworth filter to make the math easier -- I imagine a Chebychev or > an elliptic could do much better. Does anyone know what the telco's > actually used back in the days of 88mH inductors?
You don't care about aliases that fall above 3KHz if you have the processing power to filter them digitally (or do it in a reconstruction filter). That doubles the needed transition width and eases the design. Much of the needed filtering happens for free in the carbon mic. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������