Вы находитесь на странице: 1из 80

DSP PROCESSORS-III

Module 3
Syllabus
Digital Filters
IIR
FIR
Adaptive filters
DIT and DIF algorithms
Discrete-time system
Discrete-time system has discrete-time input and output signals
A discrete-time filter is a discrete-time system that passes
certain frequency components and stops others.
A Digital filter can be either an IIR or FIR filter.
An IIR filter usually requires less cost, i.e., less computation
and memory.
However, an FIR filter usually has better performance,
especially in the phase response( a generalized linear phase is
required).
Discrete-Time Filters

IIR filter
IIR filter have infinite-duration impulse
responses, hence they can be matched to analog
filters, all of which generally have infinitely long
impulse responses.

The main problem
There is no control over the phase characteristics
of the IIR filter.
Hence IIR filter designs will be treated as
magnitude-only designs.
Analysis of Ideal Filters
Consider an ideal low pass filter.
Over period (-t, t), the frequency response of an ideal low pass
filter is defined as
.
otherwise , 0
| | ), j exp(
) ( H
c

e s e eo
= e
Let x
i
(n)=A
i
exp (je
i
n) be a frequency component of the input signal.
Then, the corresponding output signal of this filter is
y
i
(n)=A
i
exp (je
i
n) H (e
i
).
If |e
i
| s e
c
, then
y
i
(n)=A
i
exp [je
i
(n-o)].
ie, xi(n) is passed with a constant delay o.
| |
.
n ,
n ,
) n (
) n ( sin
) n ( h
c
c

o =
t
e
o =
o t
o e
=
If |e
i
|>e
c
, then
y
i
(n)=0.
ie, x
i
(n) is stopped.
The impulse response of the ideal low pass filter is
Since h(n)=0 for n<0, the ideal low pass filter is non-causal and cannot
be implemented in real time.
However, in practical applications, a causal low pass filter is often
required. (The word causal indicates that the filter output depends only
on past and present inputs)
Depending on a specific application, this causal low pass filter can be
an IIR or FIR filter.
Prototype Analog Filters
IIR filter design techniques rely on existing analog
filters to obtain digital filters.
We designate these analog filters as prototype filters.

The prototypes widely used in practice
Butterworth lowpass
Chebyshev lowpass (Type I and II)
Butterworth Lowpass Filter
This filter is characterized by the property that its
magnitude response is flat in both passband and
stopband.
Moderate phase distortion
N
c
a
j H
2
2
1
1
| ) ( |
|
|
.
|

\
|
O
O
+
= O
The magnitude-squared response of an N-order lowpass
filter




c is the cutoff frequency in rad/sec.
0 10 20 30 40 50 60 70 80 90 100
0
0.2
0.4
0.6
0.8
1
1.2
N=1
N=2
N=200
N=100
Plot of the magnitude-squared response
Properties of Butterworth Filter
Magnitude Response

|H
a
(0)|
2
=1
|H
a
(j
c
) |
2
=0.5, for all N
|H
a
(j)|
2
monotonically decrease for
Approaches to ideal filter when N

Chebyshev Lowpass Filter
Chebyshev -I filters
Have equiripple response in the passband
Chebyshev -II filters
Have equiripple response in stopband
Butterworth filters
Have monotonic response in both bands

We note that by choosing a filter that has an equripple rather
than a monotonic behavior, we can obtain a low-order filter.
(The maximum delay, in samples, used in creating each
output sample is called the order of the filter )

Therefore Chebyshev filters provide lower order than
Buttworth filters for the same specifications.
Chebyshev -I filters
Chebyshev -II filters
The magnitude-squared response of Chebyshev -I filter

< <
s s
=
|
|
.
|

\
|
O
O
+
= O

x x
x x N
x T
T
j H
N
c
N
a
1 )), ( cosh(cosh
1 0 )), ( cos cos(
) (
1
1
| ) ( |
1
1
2 2
2
c

N is the order of the filter, Epsilon is the passband ripple factor
(a) For 0<x<1, T
N
(x) oscillates between 1 and 1,
and
(b) For 1<x<infinity, T
N
(x) increases monotonically to infinity

Observations
At x=0 (or =0);
|Ha(j0)|
2
= 1; for N odd;
= 1/(1+
2
); for N even
At x=1 (or = c);
|Ha(j1)|
2
=

1/(1+
2
); for all N.
For 0<=x<=1 (or 0<= <= c)
|Ha(jx)|
2
oscillates between 1 and

1 /(1+
2
)
For x>1 (or > c),
|Ha(jx)|
2
decreases monotonically to 0 .

Analog-to-digital Filter Transformations
After designing various analog filters, now transform them into
digital filters.
These transformations are derived by preserving different aspects of
analog and digital filters.
Impulse invariance transformation
Preserve the shape of the impulse response from Analog to
Digital filter
Finite difference approximation technique
Convert a differential eq. representation into a corresponding
difference eq.
Step invariance
Preserve the shape of the step response
Bilinear transformation
Preserve the system function representation from Analog to
Digital domain
Impulse Invariance Transformation
The digital filter impulse response look similar to that of a frequency-
selective analog filter.
basic principle is sampling of impulse response of an analog filter

Sample h
a
(t) at some sampling interval T to obtain h(n)
h(n)=h
a
(nT)

Since z = e
jw
on the unit circle and s = j on the imaginary axis,
we have the following transformation from the s-plane to the z-plane:
z=e
sT
also
,



and
T j jw
e e or T w
O
= O =

=
|
.
|

\
|
=
k
a
k
T
j s H
T
z H
t 2 1
) (
(Frequency-domain aliasing
formula)
Complex-plane mapping in impulse invariance transformation
Properties:
Sigma < 0, maps into |z| <1 (inside of the Unit Circle)
Sigma = 0, maps into |z| =1 (on the Unit Circle)
Sigma >0, maps into |Z| >1 (outside of the Unit circle)

Causality and Stability are the same without changing
Aliasing occur if filter not exactly band-limited
Let digital lowpass filter specifications be wp,ws,Rp and As.
To determine H(z) , first design an equivalent analog filter and then
mapping it into the desired digital filter.

Design Procedure:
1. Choose T and determine the analog frequencies:
p =w
p
/T, s = w
s
/T
2. Design an analog filter Ha(s) using the specifications with one of the
prototypes of the previous section.
3. Using partial fraction expansion, expand Ha(s) into

4. Now transform analog poles {p
k
} into digital poles {e
pkT
} to obtain the
digital filter

=
N
k
k
k
a
p s
R
s H
1
) (

=
N
k T p
k
z e
R
z H
k
1 1
1
) (
Advantages
It is a stable design and the frequencies and w are linearly
related.

Disadvantage

We should expect some aliasing of the analog frequency
response, and in some cases this aliasing is intolerable.
This design method is useful only when the analog filter is
essentially band-limited to a lowpass or band pass filter in
which there are no oscillations in the stopband.
Bilinear Transformation
transforms continuous-time system representations
to discrete-time and vice versa
This mapping is the best transformation method.
It maps positions on the j axis, in the s-plane to the
unit circle in the z-plane
For every feature in the frequency response of the analog
filter, there is a corresponding feature, with identical gain
and phase shift, in the frequency response of the digital
filter
basic principle: application of the trapezoidal formula for
numerical integration of differential equation
2 / 1
2 / 1
1
1 2
1
1
sT
sT
z
z
z
T
s

+
=
+

Complex-plane mapping in bilinear transformation


Observations
Sigma < 0 |z| < 1,
Sigma = 0 |z| = 1,
Sigma > 0 |z| > 1
The entire left half-plane maps into the inside of the
Unit circle. This is a stable transformation.
The imaginary axis maps onto the Unit circle in a
one-to-one fashion. Hence there is no aliasing in the
frequency domain.
Relation of to is nonlinear
= 2tan
-1
(T/2) = 2tan(/2)/T;
Given the digital filter specifications wp,ws,Rp and As, we want to
determine H(z).

The design steps:
1. Choose a value for T. this is arbitrary, and we may set T = 1.
2. Prewarp the cutoff freq. w
p
and w
s
;
ie, calculate p and s using
p = 2/T*tan(wp/2), s = 2/T*tan(ws/2)
3. Design an analog filter Ha(s) to meet the specifications.
4. Finally set

And simplify to obtain H(z) as a rational function in z
-1
|
|
.
|

\
|
+

1
1
1
1 2
) (
z
z
T
H z H
a
Advantage of the bilinear Transformation
It is a stable design
There is no aliasing
There is no restriction on the type of filter that can
be transformed.
FIR FILTER
A finite impulse response filter is a type of a digital filter.
The impulse response is 'finite' because it settles to zero in
a finite number of sample intervals.
The impulse response of an N
th
order FIR filter lasts for
N+1 samples, and then dies to zero.
Properties:
Inherently stable - all the poles are located at the origin
and thus are located within the unit circle.
Require no feedback- any rounding errors are not
compounded by summed iterations. This also makes
implementation simpler.
can be designed to be linear phase - which means the phase
change is proportional to the frequency.
Disadvantage:
considerably more computation power is required compared
with a similar IIR filter.
This is especially true when low frequencies are to be affected
by the filter.

Design methods:

Window design method
Frequency Sampling method
Weighted least squares design
Minimax design
Equiripple design


Window design method
Simplest FIR filter design is window function technique
Specific window should be chosen according to desired
constraints
the impulse response of the causal FIR filter is
obtained by windowing the ideal filter.

windowing h
d
(n), we can obtain the impulse response of a
causal FIR lowpass filter. ie,
h(n) = h
d
(n) w(n)
where w(n) is a window function and is equal to 0 for n<0.
Generally, w(n) is real and symmetric, and has a maximum
value of unity.
o is chosen as ,
o = (N-1)/2,
where N is the length of w(n).


n
h
d
(n)
w(n)
n
h(n)
n
Frequency Response
Window functions

The rectangular window is defined as
.
otherwise , 0
1 N n 0 , 1
) n ( w

s s
=

The Bartlett window is defined as
.
otherwise , 0
1 N n 1)/2 (N ), 1 N /( n 2 2
2 / ) 1 N ( n 0 ), 1 N /( n 2
) n ( w

s <
s s
=
.
otherwise , 0
1 N n 0 ,
1 N
n 2
cos 5 . 0 5 . 0
) n ( w

s s
|
.
|

\
|

=
The Hamming window is defined as
.
otherwise , 0
1 N n 0 ,
1 N
n 2
cos 46 . 0 54 . 0
) n ( w

s s
|
.
|

\
|

=
The Blackman window is defined as
.
otherwise , 0
1 N n 0 ,
1 N
n 4
cos 08 . 0
1 N
n 2
cos 5 . 0 42 . 0
) n ( w

s s
|
.
|

\
|

t
+
|
.
|

\
|

=
The Hann window is defined as
Bartlett Window
Rectangular Window
Hann Window
Blackman Window
Hamming Window
It can be seen that when the length of the window is fixed, a narrow
transition band corresponds to large ripples
Type of Window
Width of
Transition Band
Peak Amplitude
of Ripples
Rectangular 4t/N -21dB
Bartlett 8t/(N-1) -25dB
Hann 8t/(N-1) -44dB
Hamming 8t/(N-1) -53dB
Blackman 12t/(N-1) -74dB
Features of Commonly Used Windows.
The Kaiser window is defined as
.
otherwise 0,
1 N n 0 ,
) ( I
1
1 N
n 2
1 I
) n ( w
0
2
0

s s
|
(
(

|
.
|

\
|

|
=
Here, I
0
( ) is the zero-order modified Bessel function of the first kind
and | is a shape parameter.
| should be selected to obtain a good tradeoff between the width of
the transition band and the amplitudes of the ripples.
The windowing method is carried out in the following
steps:

1. Determine the type of the window according to the
specification for the amplitudes of the ripples.
2. Find the length of the window according to the
specification for the width of the transition band.
3. Find o
4. Determine the impulse response of the causal FIR lowpass
filter
Adaptive filter
An adaptive filter is a filter that self-adjusts its
transfer function according to an optimizing
algorithm.
Because of the complexity of the optimizing
algorithms, most adaptive filters are digital filters
that perform digital signal processing and adapt their
performance based on the input signal.
In IIR and FIR filters process parameters are
known in advance or variation is assumed to be
known
Adaptive filters are best suited when signal
conditions are slowly changing or there is large
uncertainty and filter has to compensate for that








Here the adaptive filter output y is compared with a
desired signal d to yield a error signal e which is fed
back to adaptive filter
Coefficients of adaptive filter is adjusted or optimized
using a least mean square algorithm based on the
error signal
Adaptive filter
d
x
+
-
e
y
Basic adaptive filter:
Output of adaptive filter:

y(n)= w
k
(n) x(n-k)

where w
k
(n) represent N weights for a specific time n.
The performance measure is based on the error signal.
The error signal, e(n) = d(n)-y(n)
The weights of w
k
(n) are adjusted such that a mean squared
error function is minimized
Mean square error function is E[e
2
(n)],where E represents the
expected value

K=0
N-1
Least mean square algorithm:
The simple and effective means of updating the weights
without averaging or differentiating

W
k
(n+1) = w
k
(n)+2e(n). x(n-k) , k=0,1,,N-1
Where x(n) is the input and is adaptive step size.

For each time n, weight w
k
(n) is updated or replaced by
new coefficients, unless the error function is zero.
After the output y(n), error signal e(n) and w
k
(n) are
updated for a specific time n, new sample is taken and the
adaptation process is repeated
Applications of adaptive filters

Noise cancellation
Signal prediction
Adaptive feedback cancellation
Echo cancellation

For noise cancellation:
The basic adaptive structure is modified for a noise
cancellation system

Adaptive filter
d+n
n
+
-
e
The desired signal d is corrupted by noise n.
The input to the adaptive filter is noise n that is correlated with noise n (noise
n could come from same source as n but modified by environment)
The output y is adapted to noise n
When this happens the error signal approaches to desired signal d.
The overall output is e and not the adaptive filter output y.

y
For system identification:
The same input u is given to the unknown system (plant) and to the
adaptive filter.
The error signal e is the difference between response d and the filter
output y.
The error signal e is fed to the adaptive filter and is used to update the
filter coefficients, until y = d
When this happens the adaption process is finished and e approaches to
zero.
Thus the unknown system is modeled.
Signal Prediction:
Used to provide a prediction of the present value of a random signal
This is like interference cancellation, but the adaptive filter uses a
delayed version of the primary signal as the reference.









Parameters
u = input of adaptive filter = delayed version of random signal
y = output of adaptive filter
d = desired response = random signal
e = d - y =estimation error = system output
DFT
The discrete Fourier transform (DFT) is one of the
specific forms of Fourier analysis.
It transforms one function into another, which is called
the frequency domain representation of the original
function (the time domain).
IDFT does the inverse operation
But the DFT requires an input function that is discrete and
whose non-zero values have a limited (finite) duration.
Such inputs are often created by sampling a continuous
function, like a person's voice
The FFT is based on the divide-and-conquer paradigm
The DIF FFT is the transpose of the DIT FFT
To obtain flowgraph transposes:
Reverse direction of flowgraph arrows
Interchange input(s) and output(s)


DIT butterfly: DIF butterfly:




Comparing DIT and DIF structures:

DIT FFT structure: DIF FFT structure:











Steps involved in DIF FFT algorithm:

Data shuffling not required
N=2p & input is separated into two parts .
The first set consists of first N/2 input samples with n ranging from
0 to N/2-1

Second set consists of the remaining N/2 input samples with n
ranging from N/2 to N-1

X(k) is decimated into even & odd numbered points (DIF)
decomposing an N point DFT into 2 N/2Point DFTs

The procedure is repeated till we get a 2-point DFT.

The 2-point DFT is then converted to butterfly to get the complete
structure.
DIF or DIT?

In terms of computational work load, both perform exactly
the same number of butterflies.
Each butterfly requires exactly one complex multiply and
two complex adds.
The most significant difference between simple DIF
and DIT algorithms is that DIF starts with normal
order input and generates bit reversed order output.
In contrast, DIT starts with bit reversed order
input and generates normal order output.
So use DIF for the forward transform and DIT for
the inverse transform
Advantages:
(i) Reasonably good saving in terms of computation, i.e. it
is efficient
(ii) Short Program required
(iii) Easy to understand

Disadvantages:

(i) A relatively large number of operations still required,
especially multiplications
(ii) Problem of the generation of W
N
for n=0,1,2,N-1.
Applications of FFT
Linear convolution

(1) Append zeros to the two sequences of lengths N and
M, to make them of lengths an integer power of two
that is larger than or equal to M+N-1.
(2) Apply FFT to both zero appended sequences
(3) Multiply the two transformed domain sequences
(4) Apply inverse FFT to the new multiplied sequence


THE END

Вам также может понравиться