# FIR / IIR and Wavelets

I am a self-learner of DSP by reading various books. I have accomplished basic understanding of Signals - CT and DT and a few transforms. I recently started to learn FIR / IIR Filters.

The part that I cannot understand is that they are termed as 'Filters' which for me logically means blocking / allowing from a threshold value - ex. lower values would be passed higher would be filtered or removed. So if we have a low pass filter - it would lead us to remove high values from a sequence and vice versa for high pass filters - is my understanding correct?

Like HPF (High Pass Filter):

x(n)={1,2,3,4,5,6,7,8,9}


Set threshold as >=5 so output sequence would be {5,6,7,8,9}

OK but the document states FIR / IIR about :

Finite Impulse Response (FIR) : this type of filter gives a finite number of nonzero outputs (response) to an impulse function input. It does not use feed-back.

While

Infinite Impulse Response (IIR) : this type of filter uses feed-back, so it could have an infinite number of nonzero outputs (response) to an impulse function input.

Now I cannot understand what FIR / IIR has to do with my concept of filters - allow / block high / low values. Where does the question of Feedback comes here?

Similarly for wavelets -

We call an octave a level of resolution, where each octave can be envisioned as a pair of FIR filters, at least for the one-dimensional case. One filter of the analysis (wavelet transform) pair is a lowpass filter (LPF), while the other is a highpass filter (HPF). Each filter has a down-sampler after it, to make the transform efficient. For example, a simple lowpass filter may have coefficients {1/2,1/2}, producing outputs (x[n] + x[n - 1])/2, which is clearly the average of two samples. A corresponding simple highpass filter would have coefficients {1/2,-1/2}, producing outputs (x[n] - x[n - 1])/2, half the difference of the samples.

I am not able to get the concept of how and why here equation : (x[n] + x[n - 1])/2 and (x[n] - x[n - 1])/2 is being referred?

Filters block or allow to pass, but in the frequency domain. So you first you have to transform your vector into the frequency domain, a sum of sinusoids (Fourier, et.al., said this was possible), then apply the filter to attenuate or block some of them and pass others, then transform back to your original domain to see what the result looks like. For linear systems, IIR and FIR computations just happen to produce the same result, but without having to do the 2 transforms.

• Thanks for the explanation - I get the concept where I am wrong in understanding - so using FIR / IIR computations one can by-pass to frequency to time domain transformations - so we save two times transforms - once from time domain to frequency domain then back again from frequency to time domain - then filtering would actually mean smoothing(low pass filter) / sharpening (high pass filter). Can you please eaplain a bit more on Wavelets transform? – Programmer Sep 5 '14 at 10:47

A filter applies a frequency-dependent gain to be applied to a signal.

The process you describe - removing values below a certain threshold - is not filtering in a DSP sense.

A typical FIR filter is shown below. It consists of delays, z^-1, and gains, the $b$ terms. Compare with the IIR filter shown below which has part of its output fed back into the delay structure (the gains are missing on this diagram). • Thanks but my understanding of a delay of a signal x(n) is when it gets transformed to x(n-k) where k is any positive integer. Then what does FIR / IIR filters does to a input signal - it just does addition of it values in sequences? – Programmer Sep 5 '14 at 10:07

Like HPF (High Pass Filter):

x(n)={1,2,3,4,5,6,7,8,9}

Set threshold as >=5 so output sequence would be {5,6,7,8,9}

No, that's not an HPF at all. An HPF is like this:

    x[n]  = [ 1, 3, 1, 3, 1, 3, 1, 3, 1]

HPF(x[n]) = [-1, 1,-1, 1,-1, 1,-1, 1,-1]


It throws away the low-frequency information (the constant offset of 2), and keeps the high-frequency information (the oscillation up and down every other sample).

An LPF would keep the average offset while throwing away the high-frequency changes:

LPF(x[n]) = [ 2, 2, 2, 2, 2, 2, 2, 2, 2]

• Thanks @endolith - but is it that the constant offset is always taken as 2? If my understanding is correct HPF(x[n]) is actually being calculated by [2-1=1,2+1=3,2-1=1, 2+1=3,2-1=1, 2+1=3,2-1=1, 2+1=3,2-1=1] operation cause x[n] = [ 1, 3, 1, 3, 1, 3, 1, 3, 1]? But then please explain what was meant by - "throws away the low-frequency information and keeps the high-frequency information " - how the same is achieved? How do we calculate the average offset? – Programmer Sep 6 '14 at 4:21
• @Prakash [1,1,1,1,1] has frequency 0. [3,3,3,3,3,3] also has frequency 0. The signal is not changing, so it's just a constant offset = 0 frequency. [-1,-1,+1,+1,-1,-1,+1,+1] is a lower frequency than [-1,+1,-1,+1,-1,+1,-1,+1] – endolith Sep 6 '14 at 11:52