Hubbry Logo
Finite impulse responseFinite impulse responseMain
Open search
Finite impulse response
Community hub
Finite impulse response
logo
7 pages, 0 posts
0 subscribers
Be the first to start a discussion here.
Be the first to start a discussion here.
Finite impulse response
Finite impulse response
from Wikipedia

In signal processing, a finite impulse response (FIR) filter is a filter whose impulse response (or response to any finite length input) is of finite duration, because it settles to zero in finite time. This is in contrast to infinite impulse response (IIR) filters, which may have internal feedback and may continue to respond indefinitely (usually decaying).[citation needed]

The impulse response (that is, the output in response to a Kronecker delta input) of an Nth-order discrete-time FIR filter lasts exactly samples (from first nonzero element through last nonzero element) before it then settles to zero.

FIR filters can be discrete-time or continuous-time, and digital or analog.

Definition

[edit]
A direct form discrete-time FIR filter of order N. The top part is an N-stage delay line with N + 1 taps. Each unit delay is a z−1 operator in Z-transform notation.
A depiction of a lattice type F I R filter
A lattice-form discrete-time FIR filter of order N. Each unit delay is a z−1 operator in Z-transform notation.

For a causal discrete-time FIR filter of order N, each value of the output sequence is a weighted sum of the most recent input values:

where:

  • is the input signal,
  • is the output signal,
  • is the filter order; an th-order filter has terms on the right-hand side
  • is the value of the impulse response at the i'th instant for of an -order FIR filter. If the filter is a direct form FIR filter then is also a coefficient of the filter.

This computation is also known as discrete convolution.

The in these terms are commonly referred to as taps, based on the structure of a tapped delay line that in many implementations or block diagrams provides the delayed inputs to the multiplication operations. One may speak of a 5th order/6-tap filter, for instance.

The impulse response of the filter as defined is nonzero over a finite duration. Including zeros, the impulse response is the infinite sequence:

If an FIR filter is non-causal, the range of nonzero values in its impulse response can start before , with the defining formula appropriately generalized.

Properties

[edit]

An FIR filter has a number of useful properties which sometimes make it preferable to an infinite impulse response (IIR) filter. FIR filters:

  • Require no feedback. This means that any rounding errors are not compounded by summed iterations. The same relative error occurs in each calculation. This also makes implementation simpler.
  • Are inherently stable, since the output is a sum of a finite number of finite multiples of the input values, so can be no greater than times the largest value appearing in the input.
  • Can easily be designed to be linear phase by making the coefficient sequence symmetric. This property is sometimes desired for phase-sensitive applications, for example data communications, seismology, crossover filters, and mastering.

The main disadvantage of FIR filters is that considerably more computation power in a general purpose processor is required compared to an IIR filter with similar sharpness or selectivity, especially when low frequency (relative to the sample rate) cutoffs are needed. However, many digital signal processors provide specialized hardware features to make FIR filters approximately as efficient as IIR for many applications.

Frequency response

[edit]

The filter's effect on the sequence is described in the frequency domain by the convolution theorem:

    and    

where operators and respectively denote the discrete-time Fourier transform (DTFT) and its inverse. Therefore, the complex-valued, multiplicative function is the filter's frequency response. It is defined by a Fourier series:

where the added subscript denotes -periodicity. Here represents frequency in normalized units (radians per sample). The function has a periodicity of with in units of cycles per sample, which is favored by many filter design applications.[A]  The value , called Nyquist frequency, corresponds to   When the sequence has a known sampling-rate (in samples per second), ordinary frequency is related to normalized frequency by cycles per second (Hz). Conversely, if one wants to design a filter for ordinary frequencies etc., using an application that expects cycles per sample, one would enter     etc.

can also be expressed in terms of the Z-transform of the filter impulse response:

Filter design

[edit]

FIR filters are designed by finding the coefficients and filter order that meet certain specifications, which can be in the time domain (e.g. a matched filter) or the frequency domain (most common). Matched filters perform a cross-correlation between the input signal and a known pulse shape. The FIR convolution is a cross-correlation between the input signal and a time-reversed copy of the impulse response. Therefore, the matched filter's impulse response is "designed" by sampling the known pulse-shape and using those samples in reverse order as the coefficients of the filter.[1]

When a particular frequency response is desired, several different design methods are common:

  1. Window design method
  2. Frequency sampling method
  3. Least MSE (mean square error) method
  4. Parks–McClellan method (also known as the equiripple, optimal, or minimax method). The Remez exchange algorithm is commonly used to find an optimal equiripple set of coefficients. Here the user specifies a desired frequency response, a weighting function for errors from this response, and a filter order N. The algorithm then finds the set of coefficients that minimize the maximum deviation from the ideal. Intuitively, this finds the filter that is as close as possible to the desired response given that only coefficients can be used. This method is particularly easy in practice since at least one text[2] includes a program that takes the desired filter and N, and returns the optimum coefficients.
  5. Equiripple FIR filters can be designed using the DFT algorithms as well.[3] The algorithm is iterative in nature. The DFT of an initial filter design is computed using the FFT algorithm (if an initial estimate is not available, h[n]=delta[n] can be used). In the Fourier domain, or DFT domain, the frequency response is corrected according to the desired specs, and the inverse DFT is then computed. In the time-domain, only the first N coefficients are kept (the other coefficients are set to zero). The process is then repeated iteratively: the DFT is computed once again, correction applied in the frequency domain and so on.

Software packages such as MATLAB, GNU Octave, Scilab, and SciPy provide convenient ways to apply these different methods.

Window design method

[edit]

In the window design method, one first designs an ideal IIR filter and then truncates the infinite impulse response by multiplying it with a finite length window function. The result is a finite impulse response filter whose frequency response is modified from that of the IIR filter. Multiplying the infinite impulse by the window function in the time domain results in the frequency response of the IIR being convolved with the Fourier transform (or DTFT) of the window function. If the window's main lobe is narrow, the composite frequency response remains close to that of the ideal IIR filter.

The ideal response is often rectangular, and the corresponding IIR is a sinc function. The result of the frequency domain convolution is that the edges of the rectangle are tapered, and ripples appear in the passband and stopband. Working backward, one can specify the slope (or width) of the tapered region (transition band) and the height of the ripples, and thereby derive the frequency-domain parameters of an appropriate window function. Continuing backward to an impulse response can be done by iterating a filter design program to find the minimum filter order. Another method is to restrict the solution set to the parametric family of Kaiser windows, which provides closed form relationships between the time-domain and frequency domain parameters. In general, that method will not achieve the minimum possible filter order, but it is particularly convenient for automated applications that require dynamic, on-the-fly, filter design.

The window design method is also advantageous for creating efficient half-band filters, because the corresponding sinc function is zero at every other sample point (except the center one). The product with the window function does not alter the zeros, so almost half of the coefficients of the final impulse response are zero. An appropriate implementation of the FIR calculations can exploit that property to double the filter's efficiency.

Least mean square error (MSE) method

[edit]

Goal:

To design FIR filter in the MSE sense, we minimize the mean square error between the filter we obtained and the desired filter.
, where is sampling frequency, is the spectrum of the filter we obtained, and is the spectrum of the desired filter.

Method:

Given an N-point FIR filter , and .
Step 1: Suppose even symmetric. Then, the discrete time Fourier transform of is defined as
Step 2: Calculate mean square error.
Therefore,
Step 3: Minimize the mean square error by doing partial derivative of MSE with respect to
After organization, we have
Step 4: Change back to the presentation of
and

In addition, we can treat the importance of passband and stopband differently according to our needs by adding a weighted function, Then, the MSE error becomes

Moving average example

[edit]
Block diagram of a simple FIR filter (second-order/3-tap filter in this case, implementing a moving average smoothing filter)
Block diagram of a simple FIR filter (second-order/3-tap filter in this case, implementing a moving average smoothing filter)
Pole–zero diagram
Pole–zero diagram of the example second-order FIR smoothing filter
Magnitude and phase responses of the example second-order FIR smoothing filter
Magnitude and phase responses of the example second-order FIR smoothing filter
Amplitude and phase responses of the example second-order FIR smoothing filter
Amplitude and phase responses of the example second-order FIR smoothing filter

A moving average filter is a very simple FIR filter. It is sometimes called a boxcar filter, especially when followed by decimation, or a sinc-in-frequency. The filter coefficients, , are found via the following equation:

To provide a more specific example, we select the filter order:

The impulse response of the resulting filter is:

The block diagram on the right shows the second-order moving-average filter discussed below. The transfer function is:

The next figure shows the corresponding pole–zero diagram. Zero frequency (DC) corresponds to (1, 0), positive frequencies advancing counterclockwise around the circle to the Nyquist frequency at (−1, 0). Two poles are located at the origin, and two zeros are located at , .

The frequency response, in terms of normalized frequency ω, is:

The magnitude and phase components of are plotted in the figure. But plots like these can also be generated by doing a discrete Fourier transform (DFT) of the impulse response.[B] And because of symmetry, filter design or viewing software often displays only the [0, π] region. The magnitude plot indicates that the moving-average filter passes low frequencies with a gain near 1 and attenuates high frequencies, and is thus a crude low-pass filter. The phase plot is linear except for discontinuities at the two frequencies where the magnitude goes to zero. The size of the discontinuities is π, representing a sign reversal. They do not affect the property of linear phase, as illustrated in the final figure.

See also

[edit]

Notes

[edit]

References

[edit]
Revisions and contributorsEdit on WikipediaRead on Wikipedia
from Grokipedia
A finite impulse response (FIR) filter is a type of characterized by an of finite duration, meaning the filter's output in response to an impulse input returns to zero after a limited number of samples. This property arises from the filter's structure, which computes the output as a finite sum y=k=0Mhx[nk]y = \sum_{k=0}^{M} h x[n-k], where hh are the fixed impulse response coefficients of length M+1M+1, and no feedback is involved. FIR filters are inherently to the absence of poles in their H(z)=k=0MhzkH(z) = \sum_{k=0}^{M} h z^{-k}, ensuring bounded input always produces bounded output without risk of divergence. A key advantage is their ability to achieve exactly when the coefficients are symmetric or antisymmetric, preserving the shape of the input signal with only a constant time delay, which is crucial for applications requiring minimal . They are also straightforward to implement on digital signal processors using direct-form structures like tapped delay lines, and they exhibit low sensitivity to coefficient quantization errors. In practice, FIR filters are widely used in for tasks such as low-pass, high-pass, and band-pass filtering to remove noise or extract frequency components from signals in audio processing, image enhancement, communications, and . Design methods, including windowing, frequency sampling, and optimal approaches like Parks-McClellan, allow precise control over characteristics, though longer filter lengths increase computational demands. Compared to (IIR) filters, FIR designs trade efficiency for guaranteed stability and phase linearity, making them preferable in scenarios where these properties are paramount.

Fundamentals

Definition

A finite impulse response (FIR) filter is a type of characterized by its structure, where the output at any time depends solely on the current and a finite number of past input samples, without any feedback from previous outputs. This non-recursive nature ensures that the filter's response to an impulse input settles to zero after a limited number of samples, distinguishing it from filters with infinite-duration responses. The of an FIR filter, denoted as hh, is nonzero only over a finite interval, typically 0nN10 \leq n \leq N-1 for a filter of length NN, and zero elsewhere. In a , the input signal xx passes through a series of delay elements forming a tapped delay line, where each tap is multiplied by the corresponding hh (for k=0k = 0 to N1N-1), and the results are summed to produce the output yy. This structure implements a weighted sum of recent inputs, enabling precise control over the filter's behavior. FIR filters gained prominence in the 1970s alongside advancements in , though their conceptual roots trace back to early 20th-century analog filter theory, such as transversal filters used in early communication systems. Unlike (IIR) filters, which incorporate feedback and can exhibit infinite-duration responses, FIR filters maintain inherent stability due to their finite support.

Comparison to Infinite Impulse Response Filters

Finite impulse response (FIR) filters differ fundamentally from (IIR) filters in their structure and behavior. IIR filters incorporate feedback mechanisms, where the output is recursively dependent on previous outputs, resulting in an impulse response of theoretically infinite duration due to the presence of poles in the z-plane away from the origin. This feedback enables IIR filters to achieve sharp responses with lower filter orders compared to FIR filters, making them computationally efficient for applications requiring high selectivity, such as in where is not essential. However, the feedback introduces risks of if poles lie outside the unit circle in the z-plane, and IIR filters typically exhibit nonlinear phase responses, which can distort signal timing. In contrast, FIR filters are non-recursive, relying solely on current and past inputs without feedback, ensuring all poles are at the origin in the z-plane and thus providing inherent stability regardless of coefficient values. A key advantage of FIR filters is their ability to achieve exact by designing symmetric or antisymmetric coefficients, preserving the waveform shape in applications like audio equalization and image processing. While FIR filters often require higher orders—and thus more computational resources—for comparable sharpness, their stability and phase linearity make them preferable in scenarios demanding precise .
CriterionFIR FiltersIIR Filters
StabilityInherently stable (poles only at z=0).Potentially unstable if poles are outside the unit circle.
Phase ResponseExact linear phase possible with symmetric coefficients.Generally nonlinear phase, leading to potential distortion.
Computational CostHigher due to larger number of coefficients and multiplications per output.Lower for sharp responses, as fewer coefficients suffice.
Use CasesPreferred for linear phase needs, e.g., audio and image processing.Suited for efficiency in real-time systems like speech and control.

Mathematical Formulation

Time-Domain Representation

In the time domain, a finite impulse response (FIR) filter is characterized by its output being a finite weighted sum of the current and past input samples, without any dependence on previous outputs. This non-recursive structure distinguishes FIR filters from infinite impulse response (IIR) filters and ensures a finite duration for the impulse response. The fundamental mathematical model for an FIR filter is given by the difference : y=k=0Mhx[nk]y = \sum_{k=0}^{M} h \, x[n - k] where yy is the output signal at discrete time index nn, x[nk]x[n - k] represents the input signal shifted by kk samples, hh are the filter coefficients for k=0,1,,Mk = 0, 1, \dots, M, MM is the filter order, and the filter is M+1M+1. This embodies the convolution sum, which computes each output sample as a of the most recent M+1M+1 input samples, weighted by the fixed coefficients hh. The coefficient vector \mathbf{h} = [h{{grok:render&&&type=render_inline_citation&&&citation_id=0&&&citation_type=wikipedia}}, h{{grok:render&&&type=render_inline_citation&&&citation_id=1&&&citation_type=wikipedia}}, \dots, h[M]] defines the filter's characteristics, such as its selectivity or behavior, by determining how much each past input contributes to the current output. For instance, equal coefficients might implement a simple , while varying coefficients can approximate ideal low-pass or high-pass responses. A practical example is a length-3 FIR filter (order 2), with difference equation: y = h{{grok:render&&&type=render_inline_citation&&&citation_id=0&&&citation_type=wikipedia}} x + h{{grok:render&&&type=render_inline_citation&&&citation_id=1&&&citation_type=wikipedia}} x[n-1] + h{{grok:render&&&type=render_inline_citation&&&citation_id=2&&&citation_type=wikipedia}} x[n-2] This filter processes the current input xx along with the two preceding inputs, producing an output that blends them according to the weights h{{grok:render&&&type=render_inline_citation&&&citation_id=0&&&citation_type=wikipedia}}, h{{grok:render&&&type=render_inline_citation&&&citation_id=1&&&citation_type=wikipedia}}, and h{{grok:render&&&type=render_inline_citation&&&citation_id=2&&&citation_type=wikipedia}}.

Z-Transform and Transfer Function

The provides a powerful frequency-domain representation for analyzing finite impulse response (FIR) filters, converting the time-domain into a rational function in the complex variable zz. For an FIR filter of order MM (length M+1M+1), the hh is nonzero only for 0nM0 \leq n \leq M, and its is given by H(z)=k=0Mhzk,H(z) = \sum_{k=0}^{M} h z^{-k}, which is a polynomial of degree MM in z1z^{-1}. This formulation arises directly from the definition of the z-transform applied to the finite-duration sequence hh. As a transfer function, H(z)H(z) characterizes the FIR filter as an all-zero structure, with all poles located at the origin z=0z=0 (of multiplicity MM) and no poles elsewhere in the finite z-plane. The roots of the numerator polynomial, known as the zeros of H(z)H(z), determine the filter's frequency-shaping properties, allowing designers to place zeros strategically to attenuate specific frequencies or achieve desired passband characteristics through root-finding techniques. This all-zero nature contrasts with infinite impulse response (IIR) filters and ensures inherent stability, as the region of convergence includes the entire z-plane except possibly at z=0z=0. The relationship between the z-domain and time domain is bidirectional: applying the inverse z-transform to H(z)H(z) recovers the original impulse response coefficients hh, which are simply the coefficients of the polynomial when expressed in powers of z1z^{-1}. For visualization, the pole-zero plot of a simple FIR filter, such as a two-tap averager with H(z)=1+z1H(z) = 1 + z^{-1}, reveals a single zero at z=1z = -1 and a pole at z=0z = 0 (multiplicity 1), illustrating how the zeros alone dictate the filter's response while the origin pole reflects the finite duration.

Properties

Stability and Linearity

Finite impulse response (FIR) filters possess inherent , meaning that any bounded input sequence produces a bounded output sequence. This property arises because the FIR filter's impulse response hh is of finite duration, typically nonzero only for 0nM10 \leq n \leq M-1 for some finite MM, ensuring that the output is a finite weighted sum of past and present input samples. To demonstrate BIBO stability formally, consider the output of an FIR filter given by the convolution sum: y=k=0M1hx[nk].y = \sum_{k=0}^{M-1} h \, x[n-k]. Assume the input xx is bounded such that xB<|x| \leq B < \infty for all nn, where BB is a positive constant. Then, the magnitude of the output satisfies yk=0M1hx[nk]Bk=0M1h=BH,|y| \leq \sum_{k=0}^{M-1} |h| \, |x[n-k]| \leq B \sum_{k=0}^{M-1} |h| = B \, H, where H=k=0M1h<H = \sum_{k=0}^{M-1} |h| < \infty since there are only finitely many terms and each h|h| is finite. Thus, yBH<|y| \leq B H < \infty for all nn, confirming BIBO stability regardless of the specific coefficients, as long as they are finite. This contrasts with infinite impulse response (IIR) filters, which require additional conditions like poles inside the unit circle to ensure stability. FIR filters are linear time-invariant (LTI) systems, inheriting the linearity property from the convolution operation that defines their input-output relationship. Linearity implies the superposition principle: if inputs x1x_1 and x2x_2 produce outputs y1y_1 and y2y_2, respectively, then the input ax1+bx2a x_1 + b x_2 (for scalars aa and bb) yields output ay1+by2a y_1 + b y_2. This holds because convolution is a linear operation: scaling and adding the inputs before convolving with the fixed impulse response hh is equivalent to convolving each input separately and then scaling and adding the results. The time-invariance of FIR filters ensures that a time-shifted input produces a correspondingly time-shifted output. Specifically, if xx yields yy, then the shifted input x[nn0]x[n - n_0] produces y[nn0]y[n - n_0]. This property stems from the convolution sum shifting uniformly with the input delay, as the impulse response hh remains fixed and does not depend on absolute time. Together, these LTI characteristics make FIR filters reliable for digital signal processing applications where predictable and distortion-free responses are essential.

Phase Response and Symmetry

Finite impulse response (FIR) filters can achieve linear phase by imposing symmetry or antisymmetry on their impulse response coefficients, which ensures that all frequency components of the input signal experience the same time delay. Specifically, the linear phase condition is met when the coefficients satisfy h=h[M1n]h = h[M-1-n] for symmetric cases or h=h[M1n]h = -h[M-1-n] for antisymmetric cases, where MM is the filter length and n=0,1,,M1n = 0, 1, \dots, M-1. This symmetry constrains the filter's frequency response, resulting in a phase that is a linear function of frequency. The four types of linear-phase FIR filters arise from combinations of symmetry and filter length parity:
TypeSymmetryLength ParityKey Characteristics
ISymmetricOdd (M odd)Suitable for lowpass, highpass, bandpass; no inherent zeros at DC or Nyquist.
IISymmetricEven (M even)Suitable for lowpass, bandpass; zero at Nyquist frequency.
IIIAntisymmetricOdd (M odd)Suitable for differentiators, Hilbert transformers; zeros at DC and Nyquist.
IVAntisymmetricEven (M even)Suitable for differentiators, Hilbert transformers; zero at DC.
These types are distinguished by their impulse response properties, with symmetric types (I and II) yielding purely linear phase and antisymmetric types (III and IV) exhibiting generalized linear phase with an additional π/2\pi/2 phase shift. For linear-phase FIR filters, the phase response is given by θ(ω)=M12ω\theta(\omega) = -\frac{M-1}{2} \omega for types I and II, while types III and IV include an extra constant phase term of ±π/2\pm \pi/2. This linear phase implies a constant group delay of τg=M12\tau_g = \frac{M-1}{2} samples across all frequencies, meaning the filter delays every sinusoidal component by the same amount without introducing phase distortion. The absence of phase distortion preserves the waveform shape of the input signal, making linear-phase FIR filters particularly valuable in applications such as audio processing, where temporal alignment is essential to maintain sound quality, and image processing, where it prevents geometric distortions in spatial features.

Frequency Response

Derivation from Impulse Response

The frequency response of a finite impulse response (FIR) filter is derived directly from the discrete-time Fourier transform (DTFT) of its impulse response hh, which is nonzero only for a finite duration, typically 0nM10 \leq n \leq M-1 for a causal filter of length MM. This transform evaluates how the filter modifies the frequency content of an input signal. The DTFT of the impulse response is defined as H(ejω)=k=0M1hejωk,H(e^{j\omega}) = \sum_{k=0}^{M-1} h e^{-j \omega k}, where ω\omega is the normalized angular frequency. This summation yields a complex-valued function H(ejω)H(e^{j\omega}), whose magnitude H(ejω)|H(e^{j\omega})| and phase arg{H(ejω)}\arg\{H(e^{j\omega})\} characterize the filter's gain and delay at each frequency. The expression arises from the general DTFT definition applied to the finite-length sequence hh. This frequency response can also be obtained from the z-transform of the impulse response, H(z)=k=0M1hzkH(z) = \sum_{k=0}^{M-1} h z^{-k}, by evaluating it on the unit circle in the z-plane, where z=ejωz = e^{j\omega}. Substituting z=ejωz = e^{j\omega} directly gives H(ejω)=H(z)z=ejωH(e^{j\omega}) = H(z)\big|_{z = e^{j\omega}}
Add your contribution
Related Hubs
User Avatar
No comments yet.