Chapter 16
Chapter 16
Adaptive Filters
Adaptive Filters
Dr. Naim
Dahnoun,
Bristol U
niversity
, (c) Te
xas Instr
uments 20
04
Chapter 16, Slide 2
Learning Objectives
Learning Objectives
Introduction to adaptive
Introduction to adaptive
filtering.
filtering.
LMS update algorithm.
LMS update algorithm.
Implementation of an adaptive
Implementation of an adaptive
filter using the LMS
filter using the LMS
algorithm.
algorithm.
Dr. Naim
Dahnoun,
Bristol U
niversity
, (c) Te
xas Instr
uments 20
04
Chapter 16, Slide 3
Introduction
Introduction
Adaptive filters differ from other filters such as FIR and IIR in the
Adaptive filters differ from other filters such as FIR and IIR in the
sense that:
sense that:
The coefficients are not determined by a set of desired specifications.
The coefficients are not determined by a set of desired specifications.
The coefficients are not fixed.
The coefficients are not fixed.
With adaptive filters the specifications are not known and change with
With adaptive filters the specifications are not known and change with
time.
time.
Applications include: process control, medical instrumentation, speech
Applications include: process control, medical instrumentation, speech
processing, echo and noise calculation and channel equalisation.
processing, echo and noise calculation and channel equalisation.
Dr. Naim
Dahnoun,
Bristol U
niversity
, (c) Te
xas Instr
uments 20
04
Chapter 16, Slide 4
Introduction
Introduction
To construct an adaptive filter the
To construct an adaptive filter the
following selections have to be made:
following selections have to be made:
Which method to use to update the
Which method to use to update the
coefficients of the selected filter.
coefficients of the selected filter.
Whether to use an FIR or IIR filter.
Whether to use an FIR or IIR filter.
D ig ita l
F ilte r
A d a p tiv e
A lg o r ith m
-
+
e [n ] ( e r r o r s ig n a l)
d [n ] ( d e s ir e d s ig n a l)
y [n ] ( o u tp u t s ig n a l)
x [n ] ( in p u t s ig n a l)
+
Dr. Naim
Dahnoun,
Bristol U
niversity
, (c) Te
xas Instr
uments 20
04
Chapter 16, Slide 5
Introduction
Introduction
The real challenge for designing an adaptive filter
The real challenge for designing an adaptive filter
resides with the adaptive algorithm.
resides with the adaptive algorithm.
The algorithm needs to have the following properties:
The algorithm needs to have the following properties:
Practical to implement.
Practical to implement.
Adapt the coefficients quickly.
Adapt the coefficients quickly.
Provide the desired performance.
Provide the desired performance.
Dr. Naim
Dahnoun,
Bristol U
niversity
, (c) Te
xas Instr
uments 20
04
Chapter 16, Slide 6
The LMS Update Algorithm
The LMS Update Algorithm
The basic premise of the LMS algorithm
The basic premise of the LMS algorithm
is the use of the instantaneous
is the use of the instantaneous
estimates of the gradient in the steepest
estimates of the gradient in the steepest
descent algorithm:
descent algorithm:
It has been shown that (Widrow and Stearns, 1985):
It has been shown that (Widrow and Stearns, 1985):
Finally:
Finally:
=
=
step size parameter
step size parameter
n,k
n,k
= gradient vector that makes
= gradient vector that makes
H(n) approach the optimal
H(n) approach the optimal
value H
value H
opt
opt
.
,
1
k
n
n
n
k
h
k
h
.
,
k
n
x
n
e
k
n
.
1
k
n
x
n
e
k
h
k
h
n
n
e(n) is the error
e(n) is the error
signal, where: e(n) =
signal, where: e(n) =
d(n) - y(n)
d(n) - y(n)
Dr. Naim
Dahnoun,
Bristol U
niversity
, (c) Te
xas Instr
uments 20
04
Chapter 16, Slide 7
LMS algorithm Implementation
LMS algorithm Implementation
I n itia lis a tio n 1
h [ n ] = 0
I n itia lis a tio n 2
y = 0
A c q u is itio n
r e a d th e in p u t s a m p le s : x [ n ] ,
d [ n ]
C o m p u ta tio n 1
å
1
0
]
[
]
[
N
i
i
x
i
h
y
C o m p u ta tio n 2
e = d - x
e
e
´
C o m p u ta tio n 3
k
n
x
e
k
h
k
h
n
n
1
U p d a te
x ( i ) = x ( i - 1 )
O u tp u t y
Dr. Naim
Dahnoun,
Bristol U
niversity
, (c) Te
xas Instr
uments 20
04
Chapter 16, Slide 8
temp = MCBSP0_DRR;
// Read new sample x(n)
X[0] = (short) temp;
D = X[0];
// Set desired equal to x(n) for this
// application
Y=0;
for(i=0;i<N;i++)
Y = Y + ((_mpy(h[i],X[i])) << 1) ;
// Do the FIR filter
E = D -(short) (Y>>16);
// Calculate the error
BETA_E =(short)((_mpy(beta,E)) >>15);
// Multiply error by step size parameter
for(i=N-1;i>=0;i--)
{
h[i] = h[i] +((_mpy(BETA_E,X[i])) >> 15);
// Update filter coefficients
X[i]=X[i-1];
}
MCBSP0_DXR = (temp &0xffff0000) | (((short)(Y>>16))&0x0000ffff);
// Write output
LMS algorithm Implementation
LMS algorithm Implementation
Dr. Naim
Dahnoun,
Bristol U
niversity
, (c) Te
xas Instr
uments 20
04
Chapter 16, Slide 9
Adaptive Filters Codes
Adaptive Filters Codes
Code location:
Code location:
\Code\Chapter 16 - Adaptive Filter\
\Code\Chapter 16 - Adaptive Filter\
Projects:
Projects:
Fixed Point in C:
Fixed Point in C:
\Lms_C_Fixed\
\Lms_C_Fixed\
Floating Point in C:
Floating Point in C:
\Lms_C_Float\
\Lms_C_Float\
Fixed Point in Linear Asm:
Fixed Point in Linear Asm:
\Lms_Asm_Fixed\
\Lms_Asm_Fixed\
Further reading:
Further reading:
Widrow and Stearns, 1985...
Widrow and Stearns, 1985...
Chapter 16
Chapter 16
Adaptive Filters
Adaptive Filters
- End -
- End -