I came across certain interesting Digital Signal Processing techniques past week. One of them been a problem statement and its solution for a finite impulse response filter design. I thought it would be great to put up the same as an article on the blog. Problem Statement Calculate the filter coefficients for a low-pass FIR filter with cut-off frequency 1000Hz where the sampling frequency is 5Khz. Consider the filter passband gain as unity, and the impulse response sequence length is 7. Use a Hamming window to remove spectral leakage.

Pass band gain is given to be unity. \(ie,\)

$$
H_d(e^{j\omega}) = 1 \tag1
$$

Cut-off value of \(\) is expressed as

$$
{\omega}c_1 = \frac{2\pi f_{c_1}}{F} \tag2
$$

Where \(f_{c_1}\) is the cut-off frequency and \(F\) is the sampling frequency. In the problem statement the following data is given.

*f*_{c1} = 1000*H**z*

*F* = 5000*H**z*

Now, \({}c_1\) can be calculated as follows.

$$
{\omega}c_1 = \frac{2\pi.1000}{5000} = \frac{2\pi}{5} \tag3
$$

From the above calculation,

$$
H_d(e^{j\omega}) = \left\{ \begin{array}{ll} 1 & \mbox{for } \frac{-2\pi}{5} \leq n \leq \frac{2\pi}{5} \\ 0 & \mbox otherwise \end{array} \right.
$$

The inverse DTFT (Discrete time Fourier transform)

$$
\begin{align} \mathcal h_d(n) &= \frac1{2\pi}\int_{-\pi}^{\pi}H(e^{j\omega}).e^{j{\omega}n}d\omega \\ & = \frac1{2\pi}\int_{-\frac{2\pi}5}^{\frac{2\pi}5}1* e^{j{\omega}n}d\omega \tag4 \\ & = \frac1{2\pi}\left[\frac{e^{j\omega{n}}}{jn}\right]_{\frac{-2\pi}5}^{\frac{2\pi}5} \\ & = \frac1{2\pi{jn}}\left[e^{jn\frac{2\pi}5}-e^{-jn\frac{2\pi}5}\right] \\ & = \frac1{\pi n}sin\left(\frac{2\pi n}5\right) \end{align}
$$

Now substitute values for \(n\) such that the length of the resulting sequence is 7,

− 3 ≤ *n* ≤ 3

\(h_d(-3) = -0.062\)

\(h_d(-2) = 0.0935\)

\(h_d(-1) = 0.302\)

\(h_d(0) = \)

\(h_d(1) = 0.302\)

\(h_d(2) = 0.0935\)

\(h_d(3) = -0.062\)

To calculate a finite value of \(h_d(0)\), substitute the value \(n = 0\) in equation \((4)\)

$$
\begin{align} \mathcal h_d(0) &= \frac1{2\pi}\int_{-\frac{2\pi}5}^{\frac{2\pi}5}1* e^0d\omega \\ &= \frac1{2\pi}\int_{-\frac{2\pi}5}^{\frac{2\pi}5}d\omega \\ &= \frac1{2\pi}\left[\omega\right]_{\frac{-2\pi}5}^{\frac{2\pi}5} \\ &= \frac1{2\pi}\left[\frac{2\pi}5 - \frac{-2\pi}5\right] \\ &= \frac1{2\pi}\left[\frac{2\pi}5 + \frac{2\pi}5\right] \\ &= \frac1{2\pi}\left[\frac{4\pi}5\right] \\ & = \frac25 \\ &= 0.4 \end{align}
$$

The window to be used is a Hamming window, \((= 0.5)\)

$$
W_{Hm}(n) = \left\{ \begin{array}{ll} 0.5 + 0.5cos\left(\frac{2\pi n}{N-1}\right) & \mbox{for } -\frac{N-1}{2} \leq n \leq \frac{N-1}{2} \\ 0 & \mbox otherwise \end{array} \right.
$$

The length of the sequence, \(N = 7\). The Hamming window sequence is calculated as follows,

\(W_{Hm}(-3) = 0\)

\(W_{Hm}(-2) = 0.25\)

\(W_{Hm}(-1) = 0.75\)

\(W_{Hm}(0) = 1\)

\(W_{Hm}(1) = 0.75\)

\(W_{Hm}(2) = 0.25\)

\(W_{Hm}(3) = 0\)

Apply the window over the sequence \(h_d(n)\) such that,

*h*(*n*) = *h*_{d}(*n*) * *W*_{Hm}(*n*)

\(h(-3) = 0\)

\(h(-2) = 0.0234\)

\(h(-1) = 0.2265\)

\(h(0) = 1\)

\(h(1) = 0.2265\)

\(h(2) = 0.0234\)

\(h(3) = 0\)

These are the required filter coefficients. Further, this sequence can be converted to a realisable system by calculating transfer functions.