Você está na página 1de 4

1.

Introduction
 The purpose of this lab exercise is to implement and
investigate the properties of some selected
Adaptive Signal Processing configurations used in adaptive filtering applications.
(EASP)  The tasks are performed in MATLAB, using the
MATLAB functions, implemented individually by
students, which simulate the systems employing the
Adaptive cancellation of noises and LMS algorithm.
interferences  The results should be documented in a report.
Laboratory 3

Project is co-financed by European Union within European Social Fund 2

2. Theoretical fundamentals 2. Theoretical fundamentals


 2.1. Supply network interferences cancellation in ECG  2.1. Supply network interferences cancellation in ECG
 The system for cancellation of interferences of supply network in  The useful signal s(n) with interferences i(n) from the breast
ECG considered during the laboratory is presented in the figure. electrodes is supplied after preamplifier to the primary input d(n) of
the adaptive system.
 The signal from the supply network is given (after some
suppression) at the reference input x(n).
 The goal of the adaptive filter is processing of the reference
sinusoidal signal x(n) in such a way that the signal at the filter output
y(n) would be the possibly faithful copy of the sinusoidal interference
i(n) registered by the electrodes together with the useful ECG signal.
 There are only two parameters (amplitude and phase) to estimate
and the filter of the order two is sufficient. The first coefficient scales
the reference input directly, and the second scales the signal after its
phase shift of 90 degrees. The sum of these signals form the output
signal which is the copy of the sinusoidal interference.

3 4

2. Theoretical fundamentals 2. Theoretical fundamentals


 2.2. ANC without an external reference signal  2.2. ANC without an external reference signal
 In many practical applications, receiving a separate reference  The delay ∆ should be chosen to satisfy the condition of the
signal correlated with the noise signal is impossible. In some decorrelation of the useful signal s(n) with its delayed version,
cases, if the noise signal is periodic or close to periodic and that is
the useful signal is sufficiently broadband, then it is possible to E[ s(n) s (n − ∆)] ≈ 0.
construct a reference signal x(n) internally using a delayed
(with delay ∆) version of the primary input d(n).  Due to the periodicity of the interference, there is no
decorrelation between the primary noise signal and its delayed
 The system without an external reference signal is presented
copy. As a result, the signal y(n), at the filter output, is the
below.
approximate copy of the noise signal v0(n). After its subtraction
from the primary signal d(n), we obtain the approximate copy
of the useful signal s(n).

5 6

1
2. Theoretical fundamentals 3. Computer experiments
 2.2. ANC without an external reference signal  3.1. Supply network interferences cancellation in ECG
 The effectiveness of this method of noise cancelation  Implement the system for cancelation of interferences of supply
is lower than in the case when the ideal reference is network in ECG. In order to eliminate the influence of an initial
obtainable. phase, two filers of order 1 and two input signals are employed.
 The extent to which this system is effective depends principally The first input is the sinusoid signal and the second the copy of
on how well the assumption of zero signal correlation between this signal delayed by π/2. Both signals are added and next
primary and reference signals holds up. subtracted from the primary signal (received from electrodes).
Assume the following prototype of MATLAB function
>> [e,y,ff] = lmsekg(x1,x2,d,alpha);
where x1 and x2 are the reference sinusoidal signals (one
delayed by π/2), d is an ECG signal registered by electrodes.

7 8

3. Computer experiments 3. Computer experiments


 3.1. Supply network interferences cancellation in ECG  3.1. Supply network interferences cancellation in ECG
 Load the ECG signal s from the file ecg.mat. The vector s  Generate the disturbed ECG signal adding to the signal s the
consists of 8000 samples of real ECG signal sampled with the sinusoidal signal with the frequency 50 Hz, the amplitude 0.3 and
sample rate fs = 1 kHz. As the input signal x1 and x2 use the phase π/3.
sinusoidal and cosinusoidal signals with the frequency 50 Hz, >> d = s + 0.3*sin(2*pi*(50/1000)*(1:N) + pi/3);
the unit amplitude.
>> plot((1:N)/1000,d); xlabel('Time [s]');
>> load ecg; ylabel('ECG - disturbed'); grid;
>> N = length(s);  Simulate the adaptive noise cancellation system for different
>> plot((1:N)/1000,s); xlabel('Time [s]'); values of α = 0.001, 0.01, 0.1, 1.
ylabel('ECG'); grid; >> [e,y,ff] = lmsekg(x1,x2,d,alpha);
>> x1 = sin(2*pi*(50/1000)*(1:N));  For different values of α, observe the error signal e(n)
>> x2 = cos(2*pi*(50/1000)*(1:N)); >> plot((1:N)/1000,e); xlabel('Time [s]');
ylabel('ECG – after ANC'); grid;
and compare it with the original s(n) and distrubed d(n) ECG.
9 10

3. Computer experiments 3. Computer experiments


 3.1. Supply network interferences cancellation in ECG  3.1. Supply network interferences cancellation in ECG
 Observe runs of filter coefficients estimates.  Generate the disturbed ECG signal once again adding to the
>> plot((1:N)/1000,ff'); xlabel('Time [s]'); signal s the sinusoidal signal with the frequency 50 Hz
ylabel('Filter coefficients'); grid; modulated with the sinusoid with the frequency 1 Hz. Assume
following values of the modulation coefficient m = 0.1, 0.2, 0.3.
 For different values of α calculate the relative error of filtering
defined as  1  50
N
w(n ) = 0.3 1 + m cos(2π n )  cos(2π n + π / 3).
∑ [ e( n ) − s ( n ) ]
2
 fs  fs
δ= n = N /2 +1
.
N
>> w = 0.3*(1 + m*cos(2*pi*(1:N)/1000))

n = N /2 +1
s( n ) 2
.*cos(2*pi*(1:N)*50/1000 + pi/3);
>> delta = sum((e(N/2+1:N)- >> plot((1:N)/1000,w); xlabel('Time [s]');
s(N/2+1:N)).^2,2)/sum(s(N/2+1:N).^2,2) ylabel('Interference'); grid;
 Evaluate and comment on the quality of noise cancelation for >> d = s + w;
different values of the adaptation constant α on the basis of the >> plot((1:N)/1000,d); xlabel('Time [s]');
relative error δ values and the trajectories of e(n). ylabel('ECG - disturbed'); grid;
11 12

2
3. Computer experiments 3. Computer experiments
 3.1. Supply network interferences cancellation in ECG  3.2. Analysis of behaviour of the single input LMS filter
 Simulate the adaptive noise cancellation system for different  Modify the function lms1.m in order to realize a single input
values of α = 0.001, 0.01, 0.1, 1 and m = 0.1, 0.2, 0.3. LMS filter using d(n) = x(n) and delaying the input x(n). Use the
>> [e,y,ff] = lmsekg(x1,x2,d,alpha); following prototype of this function
>> plot((1:N)/1000,e); xlabel('Time [s]'); >> [e,y,ff] = lms1_d(d,L,alpha,delta);
ylabel('ECG – after ANC'); grid; where delta is an integer delay ∆.
 Observe runs of filter coefficients estimates.  Generate N = 1000 samples of Gaussian white noise with
>> plot((1:N)/1000,ff'); xlabel('Time [s]'); zero mean and unit variance
ylabel('Filter coefficients'); grid; >> d = randn(1,N);
 Investigate the dependence of the relative error δ on the  Assume the following parameters of the filter: ∆ = 0, L = 32 and
modulation coefficient m and the adaptation constant α. α = 0.01 and simulate the single input LMS filter. Plot the error
Comment on the obtained results. signal and confirm that it decays to zero as n increases.
>> delta = sum((e(N/2+1:N)-  Investigate the influence of the varying delay ∆. Does the
s(N/2+1:N)).^2,2)/sum(s(N/2+1:N).^2,2) system continue to operate satisfactorily for non-zero delays?
13 14

3. Computer experiments 3. Computer experiments


 3.2. Analysis of behaviour of the single input LMS filter  3.3. Analysis of behaviour of ANC LMS system
 Generate N = 1000 samples of a cosinusoidal signal.  Assume that in each of following tasks the sample rate fs = 10
>> d = cos(2*pi*0.05*(0:N-1)); kHz, L = 20, ∆ = 5 and α = 0.001. Use the lms1_d function to
 Assume the following parameters of the filter: ∆ = 20, L = 20 simulate a single input ANC system.
and α = 0.01 and simulate the single input LMS filter.  Generate N = 5000 samples of an input signal d(n) = Acos(ω0nTs)
>> [e,y,ff] = lms1_d(d,L,alpha,delta); for n = 0,1,…,4999, where A = 1, ω0 = 2π500, Ts = 1/ fs.
 Does the output signal adapt to a unit amplitude sinusoid and >> d = cos(2*pi*0.05*(0:N-1));
the error signal decay to zero? Observe runs of the error  Simulate behaviour of the single input ANC system.
signal e, output signal y, and filter coefficients ff'. >> [e,y,ff] = lms1_d(d,L,alpha,delta);
 Analyze the convergence of the algorithm for different values
of ∆. In what way do the results differ from those obtained for
the random input?
 Investigate the behaviour of the algorithm for different frequen-
cies of the input cosinusoid. What conclusions can be drawn?
15 16

3. Computer experiments 3. Computer experiments


 3.3. Analysis of behaviour of ANC LMS system  3.3. Analysis of behaviour of ANC LMS system
 Confirm that the ANC LMS system behaviour is consistent with  Calculate and plot the transfer function of the filter.
the behaviour of the filter of the following transfer function. >> [H_de,f] = freqz(B,A);
E( z) 1 − 2 cos(ω0TS ) z −1 + z −2 >> plot(f/(2*pi),10*log10(abs(H_de)));
H d ,e ( z ) = = .
D( z )  α LA2   α LA2  −2 xlabel('Normalized frequency'); ylabel('Transfer
1+  − 2  cos(ω0TS ) z −1 + 1 − z
 2   2  function [dB]'); grid;
>> B = [1, -2*cos(2*pi*0.05), 1]; Comment on the obtained results.
>> A = [1, (0.001*20/2 - 2)*cos(2*pi*0.05), 1 -
0.001*20/2];
Compare outputs of ANC system and the above filter [B,A].
>> plot(e);
>> e_filter = filter(B,A,d);
>> figure; plot(e_filter);
17 18

3
3. Computer experiments
 3.3. Analysis of behaviour of ANC LMS system 4. References
 Verify the following stability limit for the system operation
4  P. M. Clarkson, Optimal and adaptive signal
0<α < .
LA2 processing, CRC Press, 1993, chapters 4.2, 5.1.
 What is the form of the filter coefficient fn(i) for n = 4999? Why?
 K. Jędrzejewski, Adaptive Signal Processing (EASP)
>> plot(ff(:,5000));
lectures: EASP L8-L9.pdf and EASP L10.pdf.
 Are the transfer function, stability limit, or filter coefficients
influenced by the choice of delay and sinusoidal phase?
 Repeat the experiment using d(n) formed as the sum of two
sinusoids with frequencies ω0 = 2π500, ω1 = 2π1000. Confirm that
the LMS behaviour is equivalent to a notched filter notching two
reference frequencies.
 >> d = cos(2*pi*0.05*(0:N-1)) +
cos(2*pi*0.1*(0:N-1));

19 Project is co-financed by European Union within European Social Fund

Você também pode gostar