Professional Documents
Culture Documents
Myles Friel
01510401
The Final Year Project is an important part of the final year of the Electronic Engineering Degree
Course in NUI, Galway. The project brief that I was assigned comes under the Signal Processing
area of Electronics. Specifically it involves Adaptive Filter Design. Basically an adaptive filter is a
filter that can mimic the impulse response of other filters or other unknown systems. An everyday
example of adaptive filters is in the telephone system. Impedance mismatches causing echoes of a
signal are a significant source of annoyance to the users of the system. The job of the adaptive filter
here is to estimate the characteristics of the echo path, generating the echo and compensate for it. To
do this the echo path is viewed as a filter with a given impulse response and the adaptive filter must
mimic this response.
Adaptive Filters are generally implemented in the time Domain and as part of the project I must
implement this, Matlab would be the programming language of choice here to develop the algorithm
and indeed all other algorithms. Adaptive Filters in the time domain generally work quite well so
long as the effective impulse response of the echo path remains relatively short. When the impulse
response of the unknown system becomes too long time domain implementation of adaptive filters
becomes quite inefficient. However there exists an alternative solution and that is to implement the
filters in the frequency domain. In this project we will investigate fixed frequency domain algorithm
to set the scene for the adaptive frequency domain algorithm. Investigation of the so called cross-
over point, this is the point where the frequency domain implementation becomes more efficient
than the time domain implementation. Remember there is high cost associated with frequency
domain implementation and the impulse response must be sufficiently long to make it more efficient
than the time domain. Once this algorithm is tried and tested in Matlab it will be translated to the C
programming language as a precursor for real time implementation.
So far the algorithm is tried and tested in Matlab and I am currently investigating the cross-over
point and comparing the memory requirements of time domain and frequency domain
implementation.
Table of Contents
Page
Chapter 1 Introduction 1
Section 1.1 Project Specification 2
Section 1.2 Project Time Frame 3
Conclusion 15
Reference and Bibliography 16
Chapter 1
Introduction.
page1
Chapter 1 Introduction
Section 1.1: Project Specification
Adaptive filters are widely used in many situations where the characteristics of some filter or other
are unknown. One application for these filters is quite an important part of today's telephone system,
that is, compensating for the echo problem. The echo path can be viewed as a filter with a certain
impulse response, and the task of the adaptive filter is to “mimic” this impulse response.
Adaptive filter implementation is common in the time domain, however for an unknown
system with a very long impulse response it becomes more efficient to implement the filter in the
frequency domain.
The objective of this project is to investigate the design and implementation of adaptive
filter algorithms, with emphasis on their use in “system identification” problems. It will be
necessary to develop simulations of adaptive filter algorithms in the time and frequency domains
and compare them from the point of view of performance and implementation complexity (in
particular to determine the “cross over point” where frequency-domain implementation becomes
more efficient). It will then be necessary to translate the frequency-domain adaptive filter into the C
programming language. A suitable laboratory test bench involving a real circuit should be
constructed in order to demonstrate the functionality in near real-time. Further investigation in other
applications scenarios may also be carried out, as well as some investigation of more efficient
implementation using integer arithmetic.
With the completion of the project we should have a fully operational adaptive filter based in
frequency domain. This filter will be applicable where the length of the unknown system's impulse
response is long enough for efficient implementation of frequency domain adaptive filtering. Time
domain adaptive filtering will not be replaced entirely as it is far more efficient for systems with
short impulse responses. A possible application for the adaptive filter in the frequency domain
arises in acoustic echo cancellation for hands free telephony.
page2
Chapter 1 Introduction
page3
Chapter 2
page4
Chapter 2 The Least Mean Squared Algorithm
The simplicity of the LMS algorithm and ease of implementation means that it is the best choice for
many real-time systems.
1. Use the Matlab “filter” function to find the desired response. Set each coefficient weight
hi=0 ,i=1,2,3,... , N , to zero.
For each sampling instant (k) carry out steps (2) to (4):
2. Load the current data sample k into the first position in the filter memory, clock it into the shift
register and move all the previous entries along one position. Calculate the output of the adaptive
filter by multiplying each element in the array of filter coefficients by the corresponding element in
the array representing the shift register and all the results are summed to give the output
corresponding to that data that was earlier clocked into the shift register.
N −1
y k = ∑ hi x i
i=0
3. Before the filter coefficients can be updated the error must be calculated simply find the
difference between the desired response and the output of the adaptive filter.
e k = y k −d k
4. To update the filter coefficients multiply the error by µ, the step size parameter and then multiply
the result by the contents of the shift register and add this result to the values of the input
coefficients previously.
hk 1=hk 2 e k x k
These algorithms are described in more detail in [1] in the References section.
page5
Chapter 2 The Least Mean Squared Algorithm
The effects of varying both the value of µ and the number of filter coefficients, N is demonstrated
in the project by programs which vary these numbers and indicate the resulting effects by means of
graphs, examples of which are shown in figures 2.1 and 2.2.
1.2
0.8
Error
0.6
0.4
0.2
0
1 2 3 4 5 6 7
Values of mu -3
x 10
page6
Chapter 2 The Least Mean Squared Algorithm
0.08
0.07
0.06
0.05
Error
0.04
0.03
0.02
0.01
0
0 5 10 15 20 25 30 35 40 45 50
Values of N
0.04
0.03
0.02
Amplitude
0.01
-0.01
-0.02
-0.03
-0.04
0 5 10 15 20 25 30 35 40 45 50
Sample instants
Close examination of figures 2.2 and 2.3 will reveal the relationship between the length of the
impulse response of the unknown system and the number of filter coefficients necessary. Although
the unknown system in figure 2.3 has fifty values taken at sample intervals it is clear that twenty
five or even less is enough to describe the system. Therefore twenty five values will also suffice for
the adaptive filter as is illustrated in figure 2.2.
page8
Chapter 3
page9
Chapter 3 Filtering in the Frequency Domain
Y = (xi_fft) x (hn_fft)
2N point IFFT
page10
Chapter 3 Filtering in the Frequency Domain
The Overlap-Save Algorithm, step by step.
1. In the implementation of this algorithm that is included on the disc let N the length of the
impulse response of the system. The length of the input is twice this at 2N.
Len zeros are added to the left of the impulse response so that the result of the FFT will be the
same length as that of the FFTs of the input sections.
2. N zeros are also added to the left and to the right of the input array to ensure that all segments
of length N will occupy both halves of the input block of which the FFT will be calculated.
3. The FFT of the impulse response is calculated and stored in memory because it will remain
unchanged.
4. Next the first block of the input is taken and the FFT of it is calculated.
5. The two FFTs are now multiplied, that is to say that each element in one of the arrays will be
multiplied by the corresponding element in the other. This procedure corresponds to
convolution in the time domain.[1]
6. The second half of this result is dumped1 for each convolution.
The first half is added to an array as the output of the filter for the given input block.
7. The input block is updated applying 50% overlap.
This algorithm has been tried and tested in the overlap-save “m file”, which is included on the disc
accompanying this report. It is a fine algorithm so long as the filter coefficients are known. In the
next section we will consider an algorithm that will enable adaptive filters to operate in the
frequency domain.
Note 1. This seemingly important data can be simply dumped because of the missing zeros in the input data which is
generally added for the purposes of convolution. A general rule of convolution is that, if N2 is the length of the impulse
response and N1 is the length of the input signal then N2-1 zeros should be added to the the input sequence and N1-1
zeros should be added to the impulse response allowing the correct linear convolution to be obtained. Note that zeros are
added to the start of the impulse response in this case and that no corresponding zeros were added to each block of
input data and therefore instead of N zeros preceding N data samples, what is had here is 2N data samples. With the
50% overlap intact the second half of each convolution sum can be dumped since it contains data which is a result of
circular convolution.
Delay
∑
αI
X
FFT Gradient
Constraint
Append
Zero Block
Delete
Last Block
Conjugate
IFFT
page12
Chapter 3 Filtering in the Frequency Domain
W1 = F2_fft. mu
W = W + W1
8. This newly updated W will now be used as the filter coefficients for the next block of input an
error will exist however, as W is updated more often this error will diminish as is indicated in
figure 3.3. which shows the convergence of the filter coefficients to the optimum.
page13
Chapter 3 Filtering in the Frequency Domain
Convergence quality
1
Desired
Adaptive Filter
0.8
0.6
0.4
0.2
Amplitude
-0.2
-0.4
-0.6
-0.8
-1
0 100 200 300 400 500 600 700 800 900 1000
Sample Number
page14
Conclusion
The project is progressing at a satisfactory rate. All areas of the project implemented to date have
been discussed in this Report, including the relevant algorithms which have been explained in
detail. I hope to start converting the Fast LMS Algorithm to the C Programming Language soon and
hopefully it will be straight forward to verify it's functionality in a simulation environment.
page15
References
[1] “Digital Signal Processing: A practical Approach”
2nd edition E.Ifeachor and B.Jervis, Prentice Hall.
[2] “Adaptive Filter Theory”, Simon Haykin
Bibliography
[1] www.music.miami.edu/programs/Mue/mue2003/research/jvandekieft/jvchapter2.
[2] “Signal Processing Algorithms in Matlab”
S.Stearns and R.David, Chapter 9
[3] IEEE Transactions on Signal Processing, Vol. 39,No. 10, October 1991.
page16