0% found this document useful (0 votes)
78 views3 pages

TRES CODE Project05 - 2up

This document outlines a Matlab project on echo cancellation using the least mean squares (LMS) algorithm. The goal is to estimate the impulse response of an unknown echo channel using a known transmitted signal and observed output, and find filter coefficients that minimize the error between the original signal and filter output. The LMS algorithm is described, which iteratively adjusts each filter coefficient proportional to the error and input signals. Sample code is provided to implement LMS for echo cancellation. Suggested approaches for the project include analyzing echo cancellation theoretically, exploring the LMS step size and filter convergence, and investigating alternative implementations like subband processing to reduce complexity.

Uploaded by

Mourad Benziane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views3 pages

TRES CODE Project05 - 2up

This document outlines a Matlab project on echo cancellation using the least mean squares (LMS) algorithm. The goal is to estimate the impulse response of an unknown echo channel using a known transmitted signal and observed output, and find filter coefficients that minimize the error between the original signal and filter output. The LMS algorithm is described, which iteratively adjusts each filter coefficient proportional to the error and input signals. Sample code is provided to implement LMS for echo cancellation. Suggested approaches for the project include analyzing echo cancellation theoretically, exploring the LMS step size and filter convergence, and investigating alternative implementations like subband processing to reduce complexity.

Uploaded by

Mourad Benziane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

In reality one doesn’t know the parameters of the echo model, which

EEE4001F: MATLAB project


possibly even change slowly over time. Adaptive filters are therefore
used to do the cancellation. Most formulations are beyond the scope of
This document provides an outline for a Matlab project to be
this course, but the LMS algorithm is within reach and is relatively easy
completed by the end of the course. You are expected to investigate, in
to understand. Instead of estimating H(z) and using it to find the G(z)
detail, methods related to solving the problem. There is a design
that cancels it, we find G(z) directly.
element to the project, and a quantitative evaluation of the performance
of the proposed methods must be performed and presented. You are to The echo removal system is modelled as a FIR filter with an unknown
write up a comprehensive report (of no more than 8 pages) describing impulse response. We estimate the required impulse response by
your method and results. You should work in groups of two, although transmitting a known signal x[n] over the channel and observing the
you may work alone if you really want to. corresponding output y[n]. (ADSL modems do this during their
training stage.) We want a system that takes the echo signal y[n] as
If you wish to propose a project of your own, then please come and talk
input, and outputs the original signal x[n].
to me. Project descriptions from previous years are on the course
website, and are also options. The output of the filter at time n is
Note that this document is still in preparation, and may be added to N
X
during the course of the project. x̂[n] = h[n] ∗ y[n] = hi y[n − i],
i=0

where the notation hi = h[i] is used for clarity. The desired output is
The Task: Simple Echo Cancellation
the known transmitted signal value x[n], so the error in the filter output
at this instant is e[n] = x[n] − x̂[n]. We want to choose the hi
The aim of this project is to investigate methods of restoring signals
parameters such that the error is minimised.
that are corrupted by one or more echos. Echos commonly occur over
communications channels such as telephone and ADSL lines. A The squared error is
reasonable model of the echo process in the time domain is N
X
2 2
e [n] = (x[n] − x̂[n]) = (x[n] − hi y[n − i])2 ,
y[n] = x[n] + a1 x[n − nd ] + a2 x[n − 2nd ], i=0

where nd is the echo delay, and a1 and a2 are reflection coefficients for which we can use to work out how hi should be changed to decrease the
the first and second echo. The echo process can be thought of in terms error. The derivative of the squared error with regard to the impulse
of a system function H(z) = Y (z)/X(z), and the task of echo response value hj is
cancellation is to find the inverse function G(z) = 1/H(z). If all the N
!
parameters in the expression above are known, then this inverse can be de2 [n] X
= −2 x[n] − hi y[n − i] y[n − j] = −2e[n]y[n − j].
found analytically. dhj i=0

1 2
If this derivative is positive, then it means that e2 [n] will become bigger % Plotting
if hj is increased. We can then decrease the error by reducing hj . ev = [ev abs(en)];
In general we fix a step size ∆, and for each sample instant we modify if rem(i,100)==0 % too slow to plot every iteration
each hj according to subplot(2,1,1); plot(h); title(’Impulse response’);
subplot(2,1,2); plot(ev); title(’|error|’);
hj ← hj + 2∆e[n]y[n − j]. pause(0.001);
This is the Least Mean Squares (LMS) algorithm. For sufficiently small end
∆ and enough training data, the values of hj will converge to the point end
where on average de2 [n]/dhj = 0 for each j (i.e. where the squared error
Copy it into a Matlab script, run it, and try to understand it.
is minimised).
Some basic code that uses the LMS algorithm to determine a filter for Approach
echo cancellation follows:
The aim of this project is to explore the problem of echo cancellation.
% Pseudorandom sequence for training The implementation of the LMS algorithm in the previous section can
d = 100; % echo delay serve as a starting point, but you can look at alternative methods
gsig = randn(16000,1); instead if you prefer.
x = gsig(d+1:end); % desired echo-free signal
Some possibilities are:
y = gsig(d+1:end) + 0.4*gsig(1:end-d); % signal with echo
• Do a theoretical analysis of echo cancellation for known delay and
% Train using LMS reflection parameters. I briefly discussed an example in class, which
M = 3*d; % FIR filter length can be elaborated upon. In the non-adaptive case one can derive
delta = 0.0001; % LMS training step size the inverse system analytically.
h = zeros(M,1); % Initial filter IR values • Explore the adaptation parameter and the effect it has on rate of
ev = []; convergence.
for i=M+1:length(x)
• Explore the effect of different echo delays on the cancellation
xn = x(i); % desired sample value
process. Since the length of the FIR filter used to cancel the echos
yn = y(i-M+1:i);
must be substantially longer than the echo delay, the number of
xnhat = h’*yn; % filter output value
filter weights that the LMS algorithm has to estimate increases with
en = xn - xnhat; % current error
increasing delay.
h = h + delta*yn*en; % update
• The LMS formulation does not make use of the knowledge that the

3 4
signal is corrupted by an echo. It should therefore be possible to use
the algorithm as provided for restoring arbitrary channel distortion,
as long as it is time invariant. You could explore alternative uses for
the cancellation system provided.
• The length of the impulse response required to cancel a long delay
is large, so the computational expense becomes high. You could
make the computation more manageable by implementing
overlap-add or overlap-save FFT-based convolution. Alternatively,
I’ve seen interesting subband approaches which I know little about.

You might also like