Upload
leonard-hopkins
View
219
Download
0
Embed Size (px)
Citation preview
Lecture 10bLecture 10b
Adaptive FiltersAdaptive Filters
2
Learning ObjectivesLearning Objectives
Introduction to adaptive filtering.Introduction to adaptive filtering. LMS update algorithm.LMS update algorithm. Implementation of an adaptive filter Implementation of an adaptive filter
using the LMS algorithm.using the LMS algorithm.
3
IntroductionIntroduction
Adaptive filters differ from other filters Adaptive filters differ from other filters such as FIR and IIR in the sense that:such as FIR and IIR in the sense that: The coefficients are not determined by a set The coefficients are not determined by a set
of desired specifications.of desired specifications. The coefficients are not fixed.The coefficients are not fixed.
With adaptive filters the specifications With adaptive filters the specifications are not known and change with time.are not known and change with time.
Applications include: process control, Applications include: process control, medical instrumentation, speech medical instrumentation, speech processing, echo and noise calculation processing, echo and noise calculation and channel equalization.and channel equalization.
4
IntroductionIntroduction
To construct an adaptive filter the following To construct an adaptive filter the following selections have to be made:selections have to be made: Which method to use to update the coefficients Which method to use to update the coefficients
of the selected filter.of the selected filter. Whether to use an FIR or IIR filter.Whether to use an FIR or IIR filter.
D ig ita lF ilter
AdaptiveA lgorithm
-
+
e[n] (error s ignal)
d [n ] (des ired s ignal)
y[n] (output s ignal)x [n ] (input s ignal)
+
5
IntroductionIntroduction
The real challenge for designing an adaptive filter resides with The real challenge for designing an adaptive filter resides with the adaptive algorithm.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.
6
The LMS Update AlgorithmThe LMS Update Algorithm
The basic premise of the LMS algorithm is the The basic premise of the LMS algorithm is the use of the instantaneous estimates of the use of the instantaneous estimates of the gradient in the steepest descent algorithm:gradient in the steepest descent algorithm:
It has been shown that (Chaissiang R - DSP It has been shown that (Chaissiang R - DSP Applications Using C and the TMS320C6x DSK, Applications Using C and the TMS320C6x DSK, Chapter 7):Chapter 7):
Finally:Finally:
= = step size parameterstep size parameter
n,k n,k = gradient vector that makes H(n) = gradient vector that makes H(n) approach the optimal value Happroach the optimal value Hoptopt
.,1 knnn khkh
., knxnekn
.1 knxnekhkh nn
e(n) is the error signal, e(n) is the error signal, where: e(n) = d(n) - y(n) where: e(n) = d(n) - y(n)
7
LMS algorithm ImplementationLMS algorithm ImplementationIn itia lisa tion 1
h [n ] = 0
In itia lisa tion 2y = 0
Acquis itionread the input sam ples: x [n ] ,
d [n ]
C om putation 1
å
1
0
][][N
i
ixihy
C om putation 2e = d - x
ee ´
C om putation 3 knxekhkh nn 1
U pdatex ( i) = x ( i-1 )
O utput y
8
temp = MCBSP0_DRR; // Read new sample x(n)
X[0] = (short) temp;D = X[0]; // Set desired equal to x(n) for this
// applicationY=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 errorBETA_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 coefficientsX[i]=X[i-1];
}
MCBSP0_DXR = (temp &0xffff0000) | (((short)(Y>>16))&0x0000ffff); // Write output
LMS algorithm ImplementationLMS algorithm Implementation
9
Adaptive Filters CodesAdaptive Filters Codes
Code location:Code location: Lab10 - Adaptive FilterLab10 - Adaptive Filter
Projects:Projects: Fixed Point in C:Fixed Point in C: \\Lms_C_FixedLms_C_Fixed\\
Further reading:Further reading: ChaissiangChaissiang
R - DSP Applications Using C and the TMS320C6x DSK R - DSP Applications Using C and the TMS320C6x DSK
Lecture 10bLecture 10b
Adaptive FiltersAdaptive Filters
- End -- End -