FIR and IIR Filter

Contents

  • Digital filter is huge part of DSP
  • input signal represnted by a discreate time sequence (fixed sampling frequency, fsf_{s})
  • Nyquist frequency limit (fracfs2frac{f_{s}}{2})
  • FIR: Finite Impulse Response
  • It is defined by a finite number of coefficients (h) , and the output is acquired by convolution of the input signal with the impulse response.
  • Fourier transform of the impulse response = frequency response of filter
    • convolution in time domain = multiplication in frequency domain
FIR fomulas
  • y(output)=x(input)hy (output) = x (input) * h
  • y[n]=j=0M1h[j] x[nj]y[n] = \sum_{j =0}^{M - 1}h[j]~x[n-j] (discrete time)
    • inpulse response length = M
Rough Design procedure
  1. design the required frequency response
  2. inverse Fourier transform
  3. find the impulse response (h)
The Window-Sinc Method

h(t)=12πinfinfX(ω)ejωtdωh(t) = \frac{1}{2\pi} \int_{\inf}^{-\inf} X(\omega)*e^{j \omega t} d\omega

h(t)=12πfcfc1ej2πftdfh(t) = \frac{1}{2\pi} \int_{f_c}^{-f_c} 1*e^{j 2 \pi f t} df

then we get sinc function

h(t)=sin(2πfct)πth(t) = \frac{sin(2 \pi f_c t)}{\pi t}

  • Problems

    • Non-casual (t < 0, value != 0): solve by shifting response
    • Infinite length: solve by truncating
    • Continuous: solve by sampling
  • The output after shifting, truncating and sampling

  • Problems
    • Side-lobes: solve by multiplying impulse response by windowing function (smoothing)
  • Choices When Designing FIR Filters
    • Sampling frequency
    • Filter length
    • Frequency response, filter type: low-pass, high-pass, band-pass, band-stop
    • Window function
    • Time-domain properties: linear phase, minimum phase, maximum flatness
  • convolution formula: y[n]=Σj=0M1h[j]x[nj]y[n] = \Sigma_{j = 0}^{M - 1} h[j]x[n - j]
  • If we use a linear buffer, we need to shift the data every time we get a new sample
  • We can solve this problem by using a circular buffer
/posts/fir-and-iir-filter/circular-buffer.png
important buffer in DSP - circular buffer
IIR FIR
Impulse Response Infinite Finite
Performance X O
Speed O X
Stability can be unstable always stable
  • IIR: Infinite Impulse Response
  • Recursive filter which use feedback to bypass a longer convolution
IIR fomulas
  • y[n]=i=0Aai x[ni]+j=1Bbj y[nj]y[n] = \sum_{i = 0}^{A}a_i~x[n-i] + \sum_{j = 1}^{B}b_j~y[n-j] (discrete time)
  • ai, bia_i,~b_i are filter coefficients
/posts/fir-and-iir-filter/IIR.png
IIR filter
Design methods
  • Online tools or Matlab
  • Use standard types: Butterworth, Chebyshev, Elliptic
  • Optimisation methods (minimise some cost function)
  • Analogues prototypes + discretisation
  • Z-transform

SKIP