DSPRelated.com
Forums

How a Digital Filter acts like a LP,BP or HP filters??

Started by yatinkamal November 30, 2006
Hello,

I have worked in Analog Tx/Rx. Past 4 years I am working in Data acq.
systems. Hence I have very good knowledge of A2D and sampling rate. But I
still don't understand how a low-pass or high pass filtering is achieved
using digital technique.

I know that in case of analog filter, if I design a low-pass filter, it's
cut-off freq. is given by 1/2piRC,which means about below this freq. all
signals will pass through the filter & above this freq. will be
attenuated.

But how can I come to this same conclusion using digital filters like
FIR,IIR etc.

In case of digital filter, I know that we will be sampling at Fs rate and
digital data of analog signal is present in memory but how can these
samples behave like a low-pass or high-pass filter.

Hope my question is clear, if not, please let me know I will send you more
details.



yatinkamal wrote:
> Hello, > > I have worked in Analog Tx/Rx. Past 4 years I am working in Data acq. > systems. Hence I have very good knowledge of A2D and sampling rate. But I > still don't understand how a low-pass or high pass filtering is achieved > using digital technique. > > I know that in case of analog filter, if I design a low-pass filter, it's > cut-off freq. is given by 1/2piRC,which means about below this freq. all > signals will pass through the filter & above this freq. will be > attenuated. > > But how can I come to this same conclusion using digital filters like > FIR,IIR etc. > > In case of digital filter, I know that we will be sampling at Fs rate and > digital data of analog signal is present in memory but how can these > samples behave like a low-pass or high-pass filter. > > Hope my question is clear, if not, please let me know I will send you more > details.
Yatinkamal, The question is quite clear, but the answer is long. If I try to write a treatise in the time I can devote to it, I will not be clear enough. Many people have written books about this, and we can recommend a few. There is a bibliography at http://dspguru.com/, and one of the books in that list is available on line at http://dspguide.com/. Try reading a bit of it. The question you asked is dealt with in Chapter 14, but I imagine you will want to read some of what comes before. If specific difficulties puzzle you along the way, ask here about them. Many people will be glad to help. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Jerry Avins wrote:
> yatinkamal wrote:
snip
>> I know that in case of analog filter, if I design a low-pass filter, it's >> cut-off freq. is given by 1/2piRC,which means about below this freq. all >> signals will pass through the filter & above this freq. will be >> attenuated. >> >> But how can I come to this same conclusion using digital filters like >> FIR,IIR etc. >> >> In case of digital filter, I know that we will be sampling at Fs rate and >> digital data of analog signal is present in memory but how can these >> samples behave like a low-pass or high-pass filter.
snip
> There is a bibliography at http://dspguru.com/, and one of the books in > that list is available on line at http://dspguide.com/. Try reading a > bit of it. The question you asked is dealt with in Chapter 14, but I > imagine you will want to read some of what comes before. > > If specific difficulties puzzle you along the way, ask here about them. > Many people will be glad to help. > > Jerry
The books on the list that Jerry linked to are all excellent (I own a copy of many of them). Another book which, in my opinion, is great for somebody with a background in analog is "Digital Filters" by Hamming. It's very cheap, and along with the Smith or Lyons books, should give you what you are looking for. Cheers Marc
This is my second reply to this message, but Google hickuped on my
first try. I quickly copied my entry before the Google page
disappeared. My message hasn't been posted yet, so here it goes again
(apologies if it appears twice):

Jerry Avins wrote:
> yatinkamal wrote: > > Hello, > > > I have worked in Analog Tx/Rx. Past 4 years I am working in Data acq. > > systems. Hence I have very good knowledge of A2D and sampling rate. But I > > still don't understand how a low-pass or high pass filtering is achieved > > using digital technique. > > > I know that in case of analog filter, if I design a low-pass filter, it's > > cut-off freq. is given by 1/2piRC,which means about below this freq. all > > signals will pass through the filter & above this freq. will be > > attenuated. > > > But how can I come to this same conclusion using digital filters like > > FIR,IIR etc. > > > In case of digital filter, I know that we will be sampling at Fs rate and > > digital data of analog signal is present in memory but how can these > > samples behave like a low-pass or high-pass filter. > > > Hope my question is clear, if not, please let me know I will send you more > > details.Yatinkamal, > > The question is quite clear, but the answer is long.
I think not. Essentially, all that digital filters do is add weighted and time-delayed copies of the input signal to produce the output signal. A simple example: Add the input signal and the input signal delayed by T, where T is the sampling period. We can normalize T = 1, and therefore the maximum allowable frequency for an input signal is w_N = pi. Look at the effect that this process has on an input signal cos(w t), with w < w_N: y(t) = cos(w t) + cos(w (t-1) ). By using a trigonometric identity (http://en.wikipedia.org/wiki/Trigonometric_identies#Sum-to-product_identities), this becomes y(t) = 2 cos( w (t + t - 1) / 2) cos(w (t - t + 1) / 2 ) = 2 cos(w t - w / 2 ) cos(w / 2). Notice how y(t) is still a cosine, but with new ampltidue 2 cos(w/2), which depends on w, and an additional phase shift of (- w / 2), which also depends (linearly) on w. When you look at the function f(w) = |2 cos(w /2)|, 0 < w < pi, you get the magnitude response of the filter, as a function of the frequency w. It's a lowpass filter. In general, a digital filter is characterized by its impulse response which specifies how one has to add up the delayed versions of the input signal, and you can do the same analysis like I have just done and will always get the same result: for a sinusoid input, you get a sinusoid output at the same frequency, weighted and phase-shifted depending on the frequency. For a general input signal, imagine the Fourier transform decomposition, and that each frequency component of the input signal is scaled by the magnitude function and shifted by the phase function of the filter to produce the output signal. Hope this gets you started, Regards, Andor
Jerry Avins wrote:
> yatinkamal wrote: > > Hello, > > > I have worked in Analog Tx/Rx. Past 4 years I am working in Data acq. > > systems. Hence I have very good knowledge of A2D and sampling rate. But I > > still don't understand how a low-pass or high pass filtering is achieved > > using digital technique. > > > I know that in case of analog filter, if I design a low-pass filter, it's > > cut-off freq. is given by 1/2piRC,which means about below this freq. all > > signals will pass through the filter & above this freq. will be > > attenuated. > > > But how can I come to this same conclusion using digital filters like > > FIR,IIR etc. > > > In case of digital filter, I know that we will be sampling at Fs rate and > > digital data of analog signal is present in memory but how can these > > samples behave like a low-pass or high-pass filter. > > > Hope my question is clear, if not, please let me know I will send you more > > details.Yatinkamal, > > The question is quite clear, but the answer is long.
I think not. Essentially, all that digital filters do is add weighted and time-delayed copies of the input signal to produce the output signal. A simple example: Add the input signal and the input signal delayed by T, where T is the sampling period. We can normalize T = 1, and therefore the maximum allowable frequency for an input signal is w_N = pi. Look at the effect that this process has on an input signal cos(w t), with w < w_N: y(t) = cos(w t) + cos(w (t-1) ). By using a trigonometric identity (http://en.wikipedia.org/wiki/Trigonometric_identies#Sum-to-product_identities), this becomes y(t) = 2 cos( w (t + t - 1) / 2) cos(w (t - t + 1) / 2 ) = 2 cos(w t - w / 2 ) cos(w / 2). Notice how y(t) is still a cosine, but with new ampltidue 2 cos(w/2), which depends on w, and an additional phase shift of (- w / 2), which also depends (linearly) on w. When you look at the function f(w) = |2 cos(w /2)|, 0 < w < pi, you get the magnitude response of the filter, as a function of the frequency w. It's a lowpass filter. In general, a digital filter is characterized by its impulse response which specifies how one has to add up the delayed versions of the input signal, and you can do the same analysis like I have just done and will always get the same result: for a sinusoid input, you get a sinusoid output at the same frequency, weighted and phase-shifted depending on the frequency. For a general input signal, imagine the Fourier transform decomposition, and that each frequency component of the input signal is scaled by the magnitude function and shifted by the phase function of the filter to produce the output signal. Hope this gets you started, Regards, Andor
"Andor" <andor.bariska@gmail.com> wrote in news:1164900353.759077.223830@
16g2000cwy.googlegroups.com:

> I think not. Essentially, all that digital filters do is add weighted > and time-delayed copies of the input signal to produce the output > signal. >
Well, in many cases, weighted and time delayed copies of the input AND OUTPUT signals. -- Scott Reverse name to reply
Andor wrote:
> Jerry Avins wrote: >> yatinkamal wrote: >>> Hello, >>> I have worked in Analog Tx/Rx. Past 4 years I am working in Data acq. >>> systems. Hence I have very good knowledge of A2D and sampling rate. But I >>> still don't understand how a low-pass or high pass filtering is achieved >>> using digital technique. >>> I know that in case of analog filter, if I design a low-pass filter, it's >>> cut-off freq. is given by 1/2piRC,which means about below this freq. all >>> signals will pass through the filter & above this freq. will be >>> attenuated. >>> But how can I come to this same conclusion using digital filters like >>> FIR,IIR etc. >>> In case of digital filter, I know that we will be sampling at Fs rate and >>> digital data of analog signal is present in memory but how can these >>> samples behave like a low-pass or high-pass filter. >>> Hope my question is clear, if not, please let me know I will send you more >>> details.Yatinkamal, >> The question is quite clear, but the answer is long. > > I think not. Essentially, all that digital filters do is add weighted > and time-delayed copies of the input signal to produce the output > signal.
Great! All an alternator does is rotate wires in a magnetic field. From this we deduce that is has an inherent current limit and will not be damaged by driving into a short circuit. The logic of that follows a simple path, but one needs a few pointers along the way.
> A simple example: Add the input signal and the input signal delayed by > T, where T is the sampling period. We can normalize T = 1, and > therefore the maximum allowable frequency for an input signal is w_N = > pi. Look at the effect that this process has on an input signal cos(w > t), with w < w_N: > > y(t) = cos(w t) + cos(w (t-1) ). > > By using a trigonometric identity > (http://en.wikipedia.org/wiki/Trigonometric_identies#Sum-to-product_identities), > this becomes > > y(t) = 2 cos( w (t + t - 1) / 2) cos(w (t - t + 1) / 2 ) > = 2 cos(w t - w / 2 ) cos(w / 2).
>
> Notice how y(t) is still a cosine, but with new ampltidue 2 cos(w/2), > which depends on w, and an additional phase shift of (- w / 2), which > also depends (linearly) on w. When you look at the function f(w) = |2 > cos(w /2)|, 0 < w < pi, you get the magnitude response of the filter, > as a function of the frequency w. It's a lowpass filter.
"Still a cosine, but with shifted phase?" I'm confused. Suppose the phase shift is pi/2: is that a cosine, or a sine?
> In general, a digital filter is characterized by its impulse response > which specifies how one has to add up the delayed versions of the input > signal, and you can do the same analysis like I have just done and will > always get the same result: for a sinusoid input, you get a sinusoid > output at the same frequency, weighted and phase-shifted depending on > the frequency. For a general input signal, imagine the Fourier > transform decomposition, and that each frequency component of the input > signal is scaled by the magnitude function and shifted by the phase > function of the filter to produce the output signal.
Impulse response? What's an impulse response? For that matter, what's an impulse? I always thought an impulse was infinite in height and of zero width. Since no digital signal can be infinite, and the duration of all samples is one sample period (doesn't everybody know that?) how can there be a digital impulse? All tongue in cheek, of course. My aim was pointing out that you were assuming a facility with basic concepts that might best be acquired with some quiet reading. 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;
yatinkamal wrote:
> I have worked in Analog Tx/Rx. Past 4 years I am working in Data acq. > systems. Hence I have very good knowledge of A2D and sampling rate. But I > still don't understand how a low-pass or high pass filtering is achieved > using digital technique. > > I know that in case of analog filter, if I design a low-pass filter, it's > cut-off freq. is given by 1/2piRC,which means about below this freq. all > signals will pass through the filter & above this freq. will be > attenuated. > > But how can I come to this same conclusion using digital filters like > FIR,IIR etc. > > In case of digital filter, I know that we will be sampling at Fs rate and > digital data of analog signal is present in memory but how can these > samples behave like a low-pass or high-pass filter. > > Hope my question is clear, if not, please let me know I will send you more > details.
An analog filter works because energy (charge or field) is stored in it's reactive elements. This stored history built up by previous input then effects the present output. The resulting output can be modeled by linear differential equations. A digital filter just stores the history of the previous input in a different form. The effects can be modeled by linear difference equations. If the input signal is "slow enough" relative to the sample rate, and you have enough bits relative to your desired S/N ratio, then the difference equations produce about the same results as the differential equations. IMHO. YMMV. -- rhn A.T nicholson d.0.t C-o-M
Ron N. wrote:

> An analog filter works because energy (charge or field) is > stored in it's reactive elements. This stored history built > up by previous input then effects the present output. The > resulting output can be modeled by linear differential > equations. > > A digital filter just stores the history of the previous input > in a different form. The effects can be modeled by linear > difference equations. If the input signal is "slow enough" > relative to the sample rate, and you have enough bits relative > to your desired S/N ratio, then the difference equations > produce about the same results as the differential equations.
Nicely put --- perhaps worth adding that the mathematical tools that we use to analyze/understand/model/design the behaviour of these systems that we call digital filters are different from those that we use for analog filters. That is, there is no notion of RC time constant being the inverse of the cutoff frequency; the signal analysis principles are the same, but the way they're applied are different. For the OP: still find it confusing? Then it would be the time to look up some Digital Filters literature to try and understand things more in detail, and not simply from an "intuitive" point of view. Carlos --
Jerry Avins wrote:
> Andor wrote: >> Jerry Avins wrote: >>> yatinkamal wrote: >>>> Hello, >>>> I have worked in Analog Tx/Rx. Past 4 years I am working in Data acq. >>>> systems. Hence I have very good knowledge of A2D and sampling rate. >>>> But I >>>> still don't understand how a low-pass or high pass filtering is >>>> achieved >>>> using digital technique. >>>> I know that in case of analog filter, if I design a low-pass filter, >>>> it's >>>> cut-off freq. is given by 1/2piRC,which means about below this freq. >>>> all >>>> signals will pass through the filter & above this freq. will be >>>> attenuated. >>>> But how can I come to this same conclusion using digital filters like >>>> FIR,IIR etc. >>>> In case of digital filter, I know that we will be sampling at Fs >>>> rate and >>>> digital data of analog signal is present in memory but how can these >>>> samples behave like a low-pass or high-pass filter. >>>> Hope my question is clear, if not, please let me know I will send >>>> you more >>>> details.Yatinkamal, >>> The question is quite clear, but the answer is long. >> >> I think not. Essentially, all that digital filters do is add weighted >> and time-delayed copies of the input signal to produce the output >> signal. > > Great! All an alternator does is rotate wires in a magnetic field. From > this we deduce that is has an inherent current limit and will not be > damaged by driving into a short circuit. The logic of that follows a > simple path, but one needs a few pointers along the way. > >> A simple example: Add the input signal and the input signal delayed by >> T, where T is the sampling period. We can normalize T = 1, and >> therefore the maximum allowable frequency for an input signal is w_N = >> pi. Look at the effect that this process has on an input signal cos(w >> t), with w < w_N: >> >> y(t) = cos(w t) + cos(w (t-1) ). >> >> By using a trigonometric identity >> (http://en.wikipedia.org/wiki/Trigonometric_identies#Sum-to-product_identities), >> >> this becomes >> >> y(t) = 2 cos( w (t + t - 1) / 2) cos(w (t - t + 1) / 2 ) >> = 2 cos(w t - w / 2 ) cos(w / 2). > > >> Notice how y(t) is still a cosine, but with new ampltidue 2 cos(w/2), >> which depends on w, and an additional phase shift of (- w / 2), which >> also depends (linearly) on w. When you look at the function f(w) = |2 >> cos(w /2)|, 0 < w < pi, you get the magnitude response of the filter, >> as a function of the frequency w. It's a lowpass filter. > > "Still a cosine, but with shifted phase?" I'm confused. Suppose the > phase shift is pi/2: is that a cosine, or a sine? > >> In general, a digital filter is characterized by its impulse response >> which specifies how one has to add up the delayed versions of the input >> signal, and you can do the same analysis like I have just done and will >> always get the same result: for a sinusoid input, you get a sinusoid >> output at the same frequency, weighted and phase-shifted depending on >> the frequency. For a general input signal, imagine the Fourier >> transform decomposition, and that each frequency component of the input >> signal is scaled by the magnitude function and shifted by the phase >> function of the filter to produce the output signal. > > Impulse response? What's an impulse response? For that matter, what's an > impulse? I always thought an impulse was infinite in height and of zero > width. Since no digital signal can be infinite, and the duration of all > samples is one sample period (doesn't everybody know that?) how can > there be a digital impulse? > > All tongue in cheek, of course. My aim was pointing out that you were > assuming a facility with basic concepts that might best be acquired with > some quiet reading. > > Jerry
Bravo I say! As someone who has taught and is in the process of attempting to master the digital domain of filtering, I admit to having already read many of the books you noted. I am now doing implementations in a FPGA (at home) to get a more intuitive feel. (I've been doing electronics for almost 4 decades and never had to get that close to the details in the digital filtering domain - now I find I need to, so I'll learn it). A student, by _definition_, does not know the subject, and can not be expected to know the background. As a longtime student of whatever comes my way, and a teacher on occasion (well, for some years), it is heartening to know others see it that way. Cheers PeteS