# Working of Digital filters...

#### RRITESH KAKKAR

Joined Jun 29, 2010
2,829
I was just thinking how Digital filters work in case of analog we just connected
RC to the signal input to amplifiers, etc
but in case of Digital filter....what happen??

Thanks

#### Papabravo

Joined Feb 24, 2006
15,521
In an FIR (Finite Impulse Response) filter the present output is a function of the current and previous inputs. If the input goes away then the output goes away. That is the 'F' in FIR.

In an IIR (Infinite Impulse Response) filter the present output is a function of the current and previous inputs AND the previous outputs. If the input goes away the out does not have to go away. That is the first 'I' in IIR.

Finite and Infinite Impusle Response refers to the output over time, NOT the amplitude of the response.

#### crutschow

Joined Mar 14, 2008
26,799
For a digital filter you first convert the analog signal to digital format by sampling the signal at greater than the Nyquist sample-rate for the highest analog frequency using an A/D converter. A digital processor then takes these samples and performs a mathematical function of the values to generate the desired filter response for each sample. If desired the samples from the filter can be then converted back to analog with a D/A converter.

#### RRITESH KAKKAR

Joined Jun 29, 2010
2,829
In case of analog low pass filter with connect R and C by using cut of frq. F=1/(2*PI*R*C)....and analyzing by Bode plot.
But this how really work in digital filters??
The input isin form of 010101010 if i want low freq. output of digital signal then what to do??

#### crutschow

Joined Mar 14, 2008
26,799
In case of analog low pass filter with connect R and C by using cut of frq. F=1/(2*PI*R*C)....and analyzing by Bode plot.
But this how really work in digital filters??
The input isin form of 010101010 if i want low freq. output of digital signal then what to do??
The digital filter algorithm is what determines the filter function. A simple low pass function can be performed by generating a running average of the digital values. Thus you would take the difference between the running average and the next sample and add a percentage of the difference to the running average. The cut-off frequency is determined by the digital sample rate and the percent value you add to the running average. It's not as simple a function as the analog circuit.

For more info look at one of these Google references.

#### Papabravo

Joined Feb 24, 2006
15,521
It works the same way except there is no R and no C. What you do have control of is the sample rate and the coefficients of the impulse response. If you know the coefficients of the impulse response you can compute the output via convolution.

http://www.dspguide.com/

I think Prof. Smith's book is still a free download by chapters in PDF format

#### RRITESH KAKKAR

Joined Jun 29, 2010
2,829
Guys can you just give an block example for better understanding of digital filters..??

#### Papabravo

Joined Feb 24, 2006
15,521
Guys can you just give an block example for better understanding of digital filters..??
Your best bet is to go to the free resources like Steve Smith's DSP book.

Here is another one

http://en.wikipedia.org/wiki/Finite_impulse_response

Boxcar filters have a low-pass characteristic similar to the multi-pole RC filter.

When you do some reading it will lead to more specific questions.

Last edited:

#### RRITESH KAKKAR

Joined Jun 29, 2010
2,829
I think i am know getting how digital filters work as first we convert analog to Digital then uC/uP do calculation like FFT,etc then output is converted analog.......

But if we talk about convolution theorem it say multiply in freq. domain, vice versa...but what the use and how does it happen in CPU itself??

#### Papabravo

Joined Feb 24, 2006
15,521
A digital filter is implemented in a CPU by a succession of multiply and accumulate (add) operations. In some processors there is even an instruction that does exactly that operation called "Multiply and Accumulate". A processor can also keep track of previous inputs and previous outputs which may also be used in the filter calculations. Was that what you were looking for?

#### RRITESH KAKKAR

Joined Jun 29, 2010
2,829
Was that what you were looking for?
Yes if we talk about many convolution method what the use of them??
what does this mean X(n)= 1 8 5 4 and H(n) impulse = 1 5 4 6
what does this mean as we calculate y(n) in real ??
pls explain me for understanding the basic of it

#### Papabravo

Joined Feb 24, 2006
15,521
I don't know precisely what you are asking but I'll try. X(n) and H(n) are discrete time functions. That means they have defined values only for values of n that belong to the set {0, 1, 2, 3}. So if I look at what you wrote it seems that
Rich (BB code):
Impulse Response H(n) = 1 5 4 6
implies H(0) = 1, H(1) = 5, H(2) = 4, and H(3) = 6
Input X(n) = 1 8 5 4
implies X(0) = 1, X(1) = 8, X(2) = 5, and X(3) = 6
Now from Smiths' book you have all the information you need to compute the output Y(n). Piece of cake -- Right?

#### RRITESH KAKKAR

Joined Jun 29, 2010
2,829
Is input X(n) mean amplitude of signal at discrete level??
and if we talk about impulse response H(n) at discrete level what this mean...these are my doubt...

#### RRITESH KAKKAR

Joined Jun 29, 2010
2,829

#### Papabravo

Joined Feb 24, 2006
15,521
A discrete time function has the the amplitudes at the defined times. The function is not defined anywhere else. You can think of X(n) and H(n) as a sequence of infinitesimally small pulses. That is how discrete time functions are defined. Sorry if you're uncomfortable with the concept.

#### RRITESH KAKKAR

Joined Jun 29, 2010
2,829
The function is not defined anywhere else. You can think of X(n)
H(n) as a sequence of infinitesimally small pulses.
But it is over my head please tell use of this pulses??

#### RRITESH KAKKAR

Joined Jun 29, 2010
2,829

#### Papabravo

Joined Feb 24, 2006
15,521
You can think of the amplitudes of a sequence of pulses as the output of a sampling mechanism. You imagine and A/D converter. At regular intervals you sample the incoming analog signal. You have no information about what the signal does in between the samples. You only know the value of the function at the sampling instant.

A famous theorem due to Shannon, unrigorously stated, says that if you sample a signal at twice the frequency of the highest frequency component you will not miss anything important.

#### RRITESH KAKKAR

Joined Jun 29, 2010
2,829
You have no information about what the signal does in between the samples. You only know the value of the function at the sampling instant.
Hi again,

I think we can see each value of signal in oscilloscope like that..

But what the use of impulse response in DSP???
or what this mean as i conform these tech. is used to see output response of a system using different signal like ramp, unit step, etc....

#### Papabravo

Joined Feb 24, 2006
15,521
It would be a great deal easier if you just read Smith's free e-book. The impulse response is the response of the filter to a discrete input function consisting of a single impulse. Once you know the impulse response you can convolve the impulse response with ANY discrete input function and compute the output. I don't understand why you are being so ...well....thick. Make some effort -- will you?