## FIR Filters (10)

### Introduction:

FIR, (Finite Impulse Response), filters are distinctive in that their impulse response lasts for a finite time duration. In contrast, IIR, (Infinite Impulse Response), filters have an impulse response which is infinite in duration. This characteristic of the IIR class is due to the fact that there are no feedback paths in the filter.

In an FIR design, all Z-Transform terms are in the numerator.  Z-Transforms, written in the Z**-1 notation only, contain a "1" in the denominator.  Z-Transforms written in the Z**+1 notation, as in FilterSolutions, have only a Z**N in the denominator, wherein, N is the number of states in the filter.

FIR filters offer several advantages compared to IIR filters:

•    Completely constant group delay throughout the frequency spectrum.
•    Complete stability at all frequencies regardless of the size of the filter.

FIR filters also have some disadvantages as well:

•    The frequency response is not as easily defined as in IIR filters
•    The number of states required to meet a frequency specification may be far larger than that required for IIR filters.

FilterSolutions allows up to 1000 taps to create a FIR filter.

### Sin(x)/x Compensation

In FIR designs there is the option to compensate for Sin(X)/X error due to sampling. One can insert an  approximate X/Sin(X) into the FIR Z transform, setting off the sampling effect. FilterSolutions offers 1st, 2nd, and 3rd order compensations that maintain the FIR characteristic of the filter, approximating X/Sin(X), valid for frequencies up to half the sample rate.

The effect of this compensation may be seen by viewing the magnitude response of a high-pass or band-stop filter at half the sample rate.

The graph below shows FilterSolutions' 3rd order compensation compared to the ideal compensation. More detailed information is available in the FilterSolutions Help file: ...  FIR 3rd Order Sin(X)/X Compensation

...Sample Rate = 20 Hz

### FIR Window Filters

The FIR filters: Rectangular, Bartlett, Hanning, Hamming, Blackman, Kaiser, and Dolph- Chebyshev, are all “Window” FIR filters. The use of the name "Window" arises from the fact that these filters are created by scaling a sinc (SIN(X)/X) pattern with a window, to produce the desired frequency effect.

All FilterSolutions FIR Window filters create the same sinc pattern, which is the Fourier Transform of a square wave pulse. The FIR selection determines the correct window used to scale the sinc pattern, thereby creating the desired filter.

While all of the Windows shown below appear similar, they are, in fact, unique. The Kaiser and Dolph-Chebyshev are adjustable.  It is the uniqueness of each Window that creates the unique FIR Window filter:

The first graph is a sinc pattern for the 29 tap low pass filter depicted in the subsequent table. The pattern is used in the initial step of creating the FIR filter.  The number of taps is the order of the filter, plus 1, to account for the 0 term. The value of the taps at the sinc curve is scaled by the Window and then is installed directly into the Z-Transform numerator.

/Filter-Solutions.com/FIR.htg/sync.gif ...29 Tap Sinc Pattern for FIR Window filter

The following table depicts the various supported Window filter functions.  The sinc pattern, H(n), shown above, is scaled by one of the Windows shown below, W(n), to create the final Z-Transform numerator.

Each "n" on the X axis becomes a Z**n in the Z-Transform. The references to n in the equations refer to the total number of taps in the filter, 29 in this example:

...Window                                                      .... 29 Tap Frequency Response

....Sample Rate = 10Hz, Cutoff = 1 Hz  ...Unity window  ...Triangular shaped window.  ...Simple cosine based window.

...W(n) = [1-COS(2PI * n/(N-1))]/2  ...Cosine plus offset based window with a small bias

...W(n) = .54 - .46*COS(2PI * n/(N-1))  ...Complex cosine offset based window

...W(n) = .42 - .50*COS(2PI * n/(N-1)) + .08*COS(4PI * n/(N-1))  /Filter-Solutions.com/FIR.htg/harrisfreq.gif

....Complex cosine offset based window

....W(n) = .35875 - .48829*cos(n/(N+1)) + .14128*cos(2.*n/(N+1))-.01168*cos(3.*n/(N+1))  ...Window based on hyperbolic Bessel functions

...The Kaiser Constant causes the width of the bell to change inversely with the constant.

...The traces here use a constant of 7.

....The Kaiser Constant is usually placed between 1 and 12.  ...Window calculated from the inverse Fourier transform of circular and hyperbolic ....Chebyshev functions.

...The stop band attenuation is partially controllable as a direct input to the Dolph-

...Chebyshev window equations. The traces here use a stop band attenuation of 70dB. The

...frequency response at the right achieved about 65-75 dB attenuation.

### Remez Filter

The Remez Filter is by far the most computationally intensive FIR filter offered by FilterSolutions. It is not a Window filter, but is generated with iterative error- reducing algorithms designed to reduce the passband error.  In addition to allowing stop band ratio and frequency definition, the Remez filter allows the "Ripple Ratio" to be defined as well.

The ripple ratio is defined to be the arithmetic passband ripple divided by twice the arithmetic stop band ripple. The Remez filter always contains an odd number of taps. If an even number is entered, FilterSolutions will reduce the tap count by one, and create the filter with an odd number of taps.

The following frequency trace is a Remez filter with 27 taps, 1Hz pass band frequency, ripple ratio of 50, and stop band frequency of 1.9 Hz.  /filter-solutions.com/FIR.htg/remezfreq.gif

........27 Tap Remez Filter

### FIR Communications Filters

The FIR filters: Raised Cosine, Root Raised Cosine, Cosine, Sine, and Matched, are generally used in communications applications, and supported only in the low-pass form. Raised Cosine Filter the ideal raised cosine filter frequency response consists of unity gain at low frequencies, a raised cosine function in the middle, and total attenuation at high frequencies. The width of the middle frequencies is defined by the roll-off factor constant, Alpha, (0<Alpha<1). In FilterSolutions, the passband frequency is defined as the 50% signal attenuation point. When the pass band frequency of a raised cosine filter is set to half the sample rate, then the impulse response, Nyquist's first criteria, is satisfied, i.e.: the impulse response is zero,  for T = NTs, where N is an integer, and T is the sample rate.

Mathematically, the frequency response may be written as: The ideal raised cosine filter frequency response is shown below: ..........Ideal Raised Cosine Frequency Response

### Root Raised Cosine Filter

In the ideal root raised cosine filter, frequency response consists of unity gain at low frequencies, the square root of raised cosine function in the middle, and total attenuation at high frequencies. The width of the middle frequencies is defined by the roll off factor constant, Alpha, (0<Alpha<1). In FilterSolutions, the pass band frequency is defined as the .707 half power point. The root raised cosine filter is generally used in series pairs, so that the total filtering effect is that of a raised cosine filter.

Mathematically, the frequency response may be written as: The ideal root raised cosine filter frequency response is shown below: ...Ideal Root Raised Cosine Frequency Response

### Cosine Filters

In the ideal cosine filter, sometimes referred to as a duo-binary filter, frequency response consists of a cosine function at low frequencies, and total attenuation at high frequencies. In FilterSolutions, the passband frequency is set to the infinite attenuation point. Nyquist's first criteria may be satisfied by the cosine filter when used in conjunction with bipolar signaling.

Mathematically, the frequency response of the cosine filter may be written as: The ideal cosine filter frequency response is shown below: ..... Ideal Cosine Filter Frequency Response

### Sine Filters

For the ideal sine filter frequency, sometimes referred to as a modified duo-binary filter, response consists of a sine function at low frequencies, and total attenuation at high frequencies.

In FilterSolutions, the pass band frequency is set at the infinite attenuation point. Nyquist's first criteria may be satisfied by the sine filter when used in conjunction with bipolar signaling. The sine filter has the advantage over a cosine filter in that the PSD is null at DC.

Mathematically, the frequency response of the cosine filter may be written as: The ideal sine filter frequency response is shown below: .....Ideal Sine Filter Frequency Response

### Matched Filters

In addition to FIR matched filters, FilterSolutions supports passive, active, and digital IIR matched filters. It is possible, however, to create much more accurate FIR matched filters than those created by other methods. The distinguishing characteristic of a Matched Filter is the step response approximates a ramp, and the impulse response approximates a pulse. The purpose of the Matched Filter is to maximize the signal to noise ratio and to minimize the probability of undetected errors received from a signal.

FilterSolutions allows the design of a Matched Filter to be determined by setting the rise time of the ramp. FilterSolutions will automatically set the sample rate to the value needed to create a matched filter with the user defined order and rise time. The proper use of the matched filter is to set the rise time to be equal to the pulse width of the pulses in a bit stream.

The ideal matched filter step and impulse response is shown below: ....Ideal Matched Filter Time Response

### FIR Analog Approximations

FilterSolutions supports FIR approximations of all supported analog filters. This is advantageous when only a limited number of bits of precision are available to create the desired IIR filter.   IIR filters, especially those of Standard Form implementation, are more susceptible to finite precision error than FIR filters.  IIR filters may become unstable if insufficient precision is available to build the desired filter.

FIR filters never become unstable.  FIR filter coefficients are always between +1 and –1, which allows for greater ease when computing with fixed point arithmetic. The FIR filter is created by directly encoding the sampled analog filter impulse response into the FIR Z-Transform. FilterSolutions allows the entry of the desired sample rate, and FIR tap number, to create an FIR approximation.

### Optimization Options

High-pass, band-pass, and band-stop FIR filters are all derived from low-pass FIR filters. The translation from the low-pass filter provides some flexibility in optimization for the final filter design.

Two optimization options are provided. The first option optimizes high-pass and band- pass filters for infinite attenuation at 0 Hz. The second option optimizes for increased attenuation in the stop band.  The requirements of the filter application determine which of the two options to use.  .Option 1: Infinite Attenuation at DC  Option 2: Increased Attenuation in the Finite Stop Band