FIR digital filters

The output of a FIR filter at a certain moment is given by the linear combination of the input samples taken in a finite number of previous moments.

FIR digital filter

This is the second part of a series of articles dedicated to digital filters. First part: Introduction to digital filters and comparison with analog filters.

The response over time to a constant input of an analog low-pass filter is typically the one shown in the figure:

Low-pass filter response

As can be seen, it consists of an initial transient oscillatory type that dampens at full speed and is due to the action of the capacitor.

This transient, therefore, is a distinctive feature of the filter. Let’s see what happens when the delay due to the transient is comparable with the timing of variation of the input signal. Suppose you have a passive low-pass filter like:

Analog low-pass filter

in which we assume R=100 kΩ and C=10 nF; a time constant τ=10-3 s follows.

At the input of the filter we place a numerical signal, see figure 3a, with how much time T = 1 ms, or equal to the time constant of the filter. Assuming the capacitor is initially discharged, during the first period of the input it will begin to charge exponentially towards the voltage of 1 V. From the theory it is known that after a constant of time, that is, 1 ms, the capacitor will have reached 63% of the final value or 0.63 V.

After 1 ms, however, the input is brought to a value equal to 2 V: the capacitor then, which is charged at 0.63 V, will now charge towards a voltage equal to: (2 – 0.63)= 1.37 V. So after another millisecond the capacitor will be charged at a voltage equal to Vu = 0.63 (0.63×1.37) V = 1.49 V.

Iterating these calculations, we find that the output voltage of the filter follows the trend in figure 3-b. The effect of the filter is to smooth the edges of the input waveform: more precisely, the filter operates the moving average.

The MA effect of the filter. a) numeric input b) output signal
Figure 3. The MA effect of the filter. a) numeric input b) output signal

Moving average

Simply, the moving (weighted) mean of a series of discrete values can be expressed as:

y(n)=a_{0}x(n)+a_{1}x(n-1)+a_{2}x(n-2)

where we assumed, for example, 3 values. The sum of the coefficients must be:

a_{0}+a_{1}+a_{2}=1

Mathematical model of an FIR digital filter

Generalizing what has been said above, the output of an FIR digital filter is obtained from the discrete convolution between the signal x(nT) and the distribution of the coefficients ai with how much time T = 1. We could demonstrate, in fact, that this discrete convolution is equivalent to a filtering operation in the time domain.

y(n)=\sum_{i=0}^{N-1}a_{i}x(n-i)

Expanding the equation to the previous finite differences, we can say that the output of an FIR filter of order N in the instant n, can be written as:

y(n)=a_{0}x(n)+a_{1}x(n-1)+...+a_{N-1}x(n-N+1)

The output at a certain moment is therefore given by the linear combination of the input samples taken in a finite number of previous moments with certain coefficients, obtained by placing unit pulses in the input of the filter in the different instants. For this reason, this type of digital filter is called Finite Impulse Response (FIR).

Final comment

The behavior of a filter can be studied more comfortably in frequency by analyzing its transfer function. We will see it in the next part of this series of articles.

About TG Team 61 Articles
We are the TG magazine editorial team, a unique pool of copywriters and engineers to get you through technologies and their impact on your business. Need our expertise for an article or white paper?