Sei sulla pagina 1di 16

1.

Finite Impulse Response (FIR) Filters;

In signal processing, there are many instances in which an input signal to a system
contains extra unnecessary content or additional noise which can degrade the quality of the
desired portion. In such cases we may remove or filter out the useless samples. For example,
in the case of the telephone system, there is no reason to transmit very high frequencies since
most speech falls within the band of 400 to 3,400 Hz. Therefore, in this case, all frequencies
above and below that band are filtered out. The frequency band between 400 and 3,400 Hz,
which isn’t filtered out, is known as the passband, and the frequency band that is blocked out
is known as the stopband.

FIR, Finite Impulse Response, filters are one of the primary types of filters used in
Digital Signal Processing. FIR filters are said to be finite because they do not have any
feedback. Therefore, if you send an impulse through the system (a single spike) then the
output will invariably become zero as soon as the impulse runs through the filter.

The finite impulse response (FIR) filter is a filter structure that can be used to
implement almost any sort of frequency response digitally. An FIR filter is usually
implemented by using a series of delays, multipliers, and adders to create the filter's output.

Figure shows the basic block diagram for an FIR filter of length N. The delays result in
operating on prior input samples. The hk values are the coefficients used for multiplication, so
that the output at time n is the summation of all the delayed samples multiplied by the
appropriate coefficients.

Figure : The logical structure of an FIR filter

The process of selecting the filter's length and coefficients is called filter design. The goal is
to set those parameters such that certain desired stopband and passband parameters will result
from running the filter. Most engineers utilize a program such as MATLAB to do their filter
design. But whatever tool is used, the results of the design effort should be the same:

1
 A frequency response plot which verifies that the filter meets the desired
specifications, including ripple and transition bandwidth.
 The filter's length and coefficients. [1]

1.1.Technical Definition ;

The difference equation that defines the output of an FIR filter in terms of its input is:

where:

 x[n] is the input signal,


 y[n] is the output signal,
 bi are the filter coefficients, also known as tap weights, and
 N is the filter order – an Nth-order filter has (N + 1) terms on the right-hand side.

These are commonly referred to as taps (the number of inputs), and one may speak
of a "5th order/6-tap filter", for instance.

This equation can also be expressed as a convolution of the coefficient sequence bi with the
input signal:

That is, the filter output is a weighted sum of the current and a finite number of previous
values of the input.[3]
1.2.Properties ;

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

 Are inherently stable. This is due to the fact that all the poles are located at the origin
and thus are located within the unit circle.
 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.

2
 They can easily be designed to be linear phase by making the coefficient sequence
symmetric; linear phase, or phase change proportional to frequency, corresponds to
equal delay at all frequencies. This property is sometimes desired for phase-sensitive
applications, for example crossover filters, and mastering.

The main disadvantage of FIR filters is that considerably more computation power is required
compared to an IIR filter with similar sharpness or selectivity, especially when low
frequencies (relative to the sample rate) cutoffs are needed.[3]

1.3.How to Characterize Digital FIR Filters;

There are a few terms used to describe the behavior and performance of FIR filter including
the following:

 Filter Coefficients - The set of constants, also called tap weights, used to multiply
against delayed sample values. For an FIR filter, the filter coefficients are, by
definition, the impulse response of the filter.
 Impulse Response – A filter’s time domain output sequence when the input is an
impulse. An impulse is a single unity-valued sample followed and preceded by zero-
valued samples. For an FIR filter the impulse response of a FIR filter is the set of filter
coefficients.
 Tap – The number of FIR taps, typically N, tells us a couple things about the filter.
Most importantly it tells us the amount of memory needed, the number of calculations
required, and the amount of "filtering" that it can do. Basically, the more taps in a
filter results in better stopband attenuation (less of the part we want filtered out), less
rippling (less variations in the passband), and steeper rolloff (a shorter transition
between the passband and the stopband).
 Multiply-Accumulate (MAC) – In the context of FIR Filters, a "MAC" is the
operation of multiplying a coefficient by the corresponding delayed data sample and
accumulating the result. There is usually one MAC per tap. [2]

3
1.4.Impulse Response ;

The impulse response h[n] can be calculated if we set in the above relation,
where δ[n] is the Kronecker delta impulse. The impulse response for an FIR filter then
becomes the set of coefficients bn, as follows

for to .

The Z-transform of the impulse response yields the transfer function of the FIR filter

FIR filters are clearly bounded-input bounded-output (BIBO) 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.[3]

1.5.Why is the impulse response "finite"?

In the common case, the impulse response is finite because there is no feedback in the
FIR.    A lack of feedback guarantees that the impulse response will be finite.  Therefore, the
term "finite impulse response" is nearly synonymous with "no feedback".

However, if feedback is employed yet the impulse response is finite, the filter still is a FIR. 
An example is the moving average filter, in which the Nth prior sample is subtracted (fed
back) each time a new sample comes in.  This filter has a finite impulse response even though
it uses feedback: after N samples of an impulse, the output will always be zero.[4]

4
1.6.How to Design a FIR Filter ?

To design a filter means to select the coefficients such that the system has specific
characteristics. The required characteristics are stated in filter specifications. Most of the time
filter specifications refer to the frequency response of the filter. There are different methods to
find the coefficients from frequency specifications:

1. Window design method


2. Frequency Sampling method
3. Weighted least squares design
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 (N + 1) coefficients that minimize the maximum deviation
from the ideal. Intuitively, this finds the filter that is as close as you can get to the desired
response given that you can use only (N + 1) coefficients.

This method is particularly easy in practice since at least one text includes a program that
takes the desired filter and N, and returns the optimum coefficients.

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

Some of the time, the filter specifications refer to the time-domain shape of the input
signal the filter is expected to "recognize". The optimum matched filter is to sample that
shape and use those samples directly as the coefficients of the filter -- giving the filter an
impulse response that is the time-reverse of the expected input signal.[5]

1.7.Window Design Method;

In the Window Design Method, one designs an ideal IIR filter, then applies a window
function to it in the time domain, multiplying the infinite impulse by the window function.
This results in the frequency response of the IIR being convolved with the frequency response
of the window function thus the imperfections of the FIR filter (compared to the ideal IIR
filter) can be understood in terms of the frequency response of the window function.

The ideal frequency response of a window is a Dirac delta function, as that results in
the frequency response of the FIR filter being identical to that of the IIR filter, but this is not
attainable for finite windows, and deviations from this yield differences between the FIR
response and the IIR response. [5]

5
1.8.What are the advantages of FIR Filters (compared to IIR filters)?
Compared to IIR filters, FIR filters offer the following advantages:

 They can easily be designed to be "linear phase" (and usually are). Put simply,
linear-phase filters delay the input signal but don’t distort its phase.
 They are simple to implement. On most DSP microprocessors, the FIR
calculation can be done by looping a single instruction.
 They are suited to multi-rate applications. By multi-rate, we mean either
"decimation" (reducing the sampling rate), "interpolation" (increasing the
sampling rate), or both. Whether decimating or interpolating, the use of FIR
filters allows some of the calculations to be omitted, thus providing an
important computational efficiency. In contrast, if IIR filters are used, each
output must be individually calculated, even if it that output will discarded (so
the feedback will be incorporated into the filter).
 They have desireable numeric properties. In practice, all DSP filters must be
implemented using finite-precision arithmetic, that is, a limited number of bits.
The use of finite-precision arithmetic in IIR filters can cause significant
problems due to the use of feedback, but FIR filters without feedback can
usually be implemented using fewer bits, and the designer has fewer practical
problems to solve related to non-ideal arithmetic.
 They can be implemented using fractional arithmetic. Unlike IIR filters, it is
always possible to implement a FIR filter using coefficients with magnitude of
less than 1.0. (The overall gain of the FIR filter can be adjusted at its output, if
desired.) This is an important consideration when using fixed-point DSP's,
because it makes the implementation much simpler. [5]

1.9.What are the disadvantages of FIR Filters (compared to IIR filters)?

Compared to IIR filters, FIR filters sometimes have the disadvantage that they require
more memory and/or calculation to achieve a given filter response characteristic. Also, certain
responses are not practical to implement with FIR filters.[5]

6
2.Infinite Impulse Response (IIR) Filters

Digital filters which must be implemented recursively are called Infinite Impulse
Response (IIR) filters because, theoretically, the response of these filters to an impulse never
settles to zero. In practice, the impulse response of many IIR filters approaches zero
asymptotically, and may actually reach zero in a finite number of samples due to the finite
word length of digital computers. A Kth order IIR filter is described by the difference
equation,

y(n)=-∑Kk=1 aky(n-k)+ ∑Kk=0bkx(n-k)

where each output sample depends on present and past input samples, as well as output
samples. A direct form II realization of a general IIR filter is shown in figure 1. The recursive
part of the filter causes the response to an impulse input to endure (theoretically) forever. This
is why such filters are called IIR filters . A distinct advantage of IIR filters over FIR filters is
that IIR filters can yield an equivalent magnitude response using a much lower filter order. A
drawback of IIR filters is that they have non-linear phase responses, which can cause severe
problems for phase sensitive velocity estimation such as the autocorrelation technique.
However, several investigations showed, that IIR filters can be used for clutter rejection.

Figure 1:Direct form II realization of a general IIR filter.

7
An output of an IIR filter consists of a transient component and a steady-state component:

y(n)= ytr(n)+ yss(n)

Assuming a stable filter, the first term vanishes as n=>∞ . CRFs must operate with a
finite number of samples.n does not go to ∞, so the transient response of the filter becomes
important. Initialization of the inner states of the filter can yield a suppression of the transient
response and can reduce the ``ring-down time". The ``ring-down time" is referred to as the
time the transient response dominates the output of the IIR filter.

2.1.Common types of IIR filter:

Type Characteristics

Butterworth Maximally flat amplitude

Bessel Maximally flat group delay

Chebyshev Equiripple in passband or stop-band

Elliptic Equiripple in passband and stop-band

2.2.Minimizing Peak Error

The Chebyshev, Chebyshev II, and elliptic filters minimize peak error by accounting
for the maximum tolerable error in their frequency response. The maximum tolerable error is
the maximum absolute value of the difference between the ideal filter frequency response and
the actual filter frequency response. The amount of ripple, in dB, allowed in the frequency
response of the filter determines the maximum tolerable error. Depending on the type, the
filter minimizes peak error in the passband, stopband, or both.

2.3.Butterworth Filters

Butterworth filters have the following characteristics:

 Smooth response at all frequencies


 Monotonic decrease from the specified cut-off frequencies
 Maximal flatness, with the ideal response of unity in the passband and zero in the
stopband
 Half-power frequency, or 3 dB down frequency, that corresponds to the specified
cut off frequencies

8
The advantage of Butterworth filters is their smooth, monotonically decreasing frequency
response. Butterworth filters do not always provide a good approximation of the ideal filter
response because of the slow rolloff between the passband and the stopband.

2.4.Chebyshev Filters

Chebyshev filters have the following characteristics:

 Minimization of peak error in the passband


 Equiripple magnitude response in the passband
 Monotonically decreasing magnitude response in the stopband
 Sharper rolloff than Butterworth filters

Compared to a Butterworth filter, a Chebyshev filter can achieve a sharper transition


between the passband and the stopband with a lower order filter. The sharp transition between
the passband and the stopband of a Chebyshev filter produces smaller absolute errors and
faster execution speeds than a Butterworth filter.

2.5.Chebyshev II Filters

Chebyshev II filters have the following characteristics:

 Minimization of peak error in the stopband


 Equiripple magnitude response in the stopband
 Monotonically decreasing magnitude response in the passband
 Sharper rolloff than Butterworth filters

Chebyshev II filters are similar to Chebyshev filters. However, Chebyshev II filters


differ from Chebyshev filters in the following ways:

 Chebyshev II filters minimize peak error in the stopband instead of the passband.
Minimizing peak error in the stopband instead of the passband is an advantage of
Chebyshev II filters over Chebyshev filters.
 Chebyshev II filters have an equiripple magnitude response in the stopband
instead of the passband.
 Chebyshev II filters have a monotonically decreasing magnitude response in the
passband instead of the stopband.

9
Chebyshev II filters have the same advantage over Butterworth filters that Chebyshev
filters have—a sharper transition between the passband and the stopband with a lower order
filter, resulting in a smaller absolute error and faster execution speed.

2.6.Elliptic Filters

Elliptic filters have the following characteristics:

 Minimization of peak error in the passband and the stopband


 Equiripples in the passband and the stopband

Compared with the same order Butterworth or Chebyshev filters, the elliptic filters provide
the sharpest transition between the passband and the stopband, which accounts for their
widespread use.

2.7.Bessel Filters

Bessel filters have the following characteristics:

 Maximally flat response in both magnitude and phase


 Nearly linear-phase response in the passband

Bessel filters uses to reduce nonlinear-phase distortion inherent in all IIR filters. High-
order IIR filters and IIR filters with a steep roll-off have a pronounced nonlinear-phase
distortion, especially in the transition regions of the filters. Linear-phase response can be
obtain with FIR filters. Like Butterworth filters, Bessel filters require high-order filters to
minimize peak error, which accounts for their limited use.

2.8.IIR Filter Implementation

Since an Infinite Impulse Response filter contains feedback loops, its output at every time
step depends on previous outputs, and the filter must be implemented recursively with
difference equations. The discrete transfer function

10
is implemented with the difference equation

An IIR filter is stable if the absolute values of the roots of the denominator of the discrete
transfer function a(z) are all less than one. The impulse response of a stable IIR filter
approaches zero as the time index k approaches infinity. The frequency response function
of a stable IIR filter is the Discrete Fourier Transform of the filter's impulse response.

3.LMS ALGORITHM

3.1.Introduction

Lms Algorithm the basic idea: adjustment of the filter parameters let the mean squares
error between the filter output signal and the expectations output signals be smallest.

The Lms Algorithm is a linear adaptive filtering algorithm that consists of two basic
processes:

1. A filtering process, which involves


a) Computing the output of a transversal filter produced by a set of tap inputs, and
b) Generating an estimation error by comparing this output to a desired value.
2. An Adaptive process, which involves the automatic adjustment of the tap weights of
the filter in accordance with the estimation error.

11
3.2.Main Idea & Deriving The Formula

(1)

The filter coefficients are indicated as bn(k). “n” represent that the coefficients vary
with time.

This approach is usually called the LMS recursive algorithm. As in Wiener filter
theory, this algorithm also determines the optimal filter coefficients, and it is also based
on minimizing the squared error, but it does not require computation of the correlation
functions, rxx and rxy. Instead the LMS algorithm uses a recursive gradient method
known as the steepest-descent method for finding the filter coefficients that produce the
minimum sum of squared error.

(2)

Examination of equation (on the above (2)) shows that the sum of squared errors is a
quadratic function of the FIR filter coefficients, b(k); hence, this function will have a
single minimum. The goal of the LMS algorithm is to adjust the coefficients so that the
sum of squared error moves toward this minimum. The technique used by the LMS
algorithm is to adjust the filter coefficients based on the method of steepest descent. In
this approach, the filter coefficients are modified based on an estimate of the negative
gradient of the error function with respect to a given b(k). This estimate is given by the
partial derivative of the squared error, ε, with respect to the coefficients bn(k):

12
(3)

Since d(n) is independent from the coefficients bn(k), its partial derivative with respect
to bn(k) is zero. Because of that the y(n) is a function of the input times bn(k), its partial
derivative with respect to the bn(k) is x(n-k). Thus the equation (3) can be rewritten in
terms of the instantaneous product of error and the input:

(4)

Initially, the filter coefficients are set arbitrarily to some b0(k), usually zero. With
each new input sample a new error signal, e(n), can be computed . Based on this new error
signal, the new gradient is determined (Eq. (4)), and the filter coefficients are updated:

(5)

Here, “k” denotes the tap number, “n” is the recursion number. A common rule is to
select the convergence parameter, ∆, such that it lies in the range:

where L is the length of the FIR filter and Px is the power in the input signal.

PX can be approximated by:

13
4.PSEUDO CODE OF THE LMS ALGORITHM

Inputs: {

x= input signal;

delta= convergence gain;

N= order of the FIR filter;}

Outputs: {

b= filter coefficients;

s’= the output of the Adaptive filter;

e=error (e=x-s’); }

M= length of x;

b0= initial filter coefficients (a zero matrix (N,M)) ;

for recursion number counter increase by one from one to M

for tap number coounter increase by one from one to N

“h“ is equals to “h”(last one) plus { “delta” multiply “e” multiply “x” }

End

“s” is equal to filter operation of the coefficients “b” and the data “x”;

“e” is equal to the “x” mines “s”;

End

Plot commands…

14
REFERANCES FOR THE LMS ALGORITHM

 “Biosignal and Biomedical Image Processing ,MATLAB-Based Applications” ,


JOHN L. SEMMLOW, Robert Wood Johnson Medical School New Brunswick,
New Jersey, U.S.A. Rutgers University Piscataway, New Jersey, U.S.A;
 “Adaptive Filter Theory”, Simon HAYKIN

REFERANCES FOR FIR FILTERS

 [1]; http://www.netrino.com ; Introdution to Digital FIR Filters.


 [2]; http://www.dspguru.com ; FIR Filter Basics.
 [3]; http://www.wikipedia.org ; Finite Impulse Response.
 [4]; DSP First [James H. McClellan].
 [5]; Digital Signal Processing in Telecommunications [F.A Westall & S.F.A Ip]

REFERANCES FOR IIR FILTERS

 http://www.wikipedia.org ; Infinite Impulse Response.


 ''Adaptive Filter Theory'',Second Edition, Simon HAYKIN
 ''Digital Signal Processing in Telecommunications'',Chapman and Hall, F.A
Westall and S.F.A Ip

15
16

Potrebbero piacerti anche