function the ability of modelling non-stationary pro-
cesses.
The RLS algorithm adaptively updates the coeffi-
cient vector to minimize the summation of weighted
least-square errors. In particular, it defines the R and
p parameters, introducing the forgetting factor λ:
R(k) =
k
∑
i=0
λ
k−1
x(i)x
T
(k) = X
T
(k)X(k) (9)
p(k) =
k
∑
i=0
λ
k−1
d(i)x(i)0X
T
(k)d(k) (10)
Consequently, the optimum solution takes the
form:
w(k) = R
−1
(k)[x(k)e(k) + R(k)w(k − 1)] (11)
The computation of the inverse matrix of R can
be reduced significantly by using the matrix inversion
lemma, obtaining:
R
−1
=
1
λ
[R
−1
(k − 1) − κ(k)k
T
(k)] (12)
where:
κ(k) = R
−1
(k)x(k) (13)
k(k) = R
−1
(k − 1)x(k) (14)
At each step, the RLS algorithm estimates R and
P based on all past data and updates the weight vector
using the matrix inversion lemma. The filter coeffi-
cient update equation becomes:
w(k) = w(k − 1) + e
∗
(k)κ(k) (15)
The RLS filter does not attempt to solve the
Wiener solution at each step, that would require the
calculation of repeated inverted R matrix, but updates
R
−1
(k) using R
−1
(k − 1), the inverted R matrix of the
previous step. In this case, no matrix inversion is re-
quired, as it is shown in Eq. 15. The only invertible
matrix that is required to be calculated is R
−1
(0).
In this application, a multireference RLS adaptive
filter is used to process each EMG channel d(k) for
ECG interference cancellation. The three projections
of the ECG along the three orthogonal axes described
by the combination of the four electrodes on the torso
represent the three different components of x(k). In
the particular case of multi-reference, the block dia-
gram presents a difference in the x(k) input signal, as
it is shown in Fig. 5, where the input vector at k instant
does not present only one sample, but the samples at
k instant of all the inputs considered by the system.
For the RLS filter computation, at k = 0, the initial
instant, two variables must be chosen from the user:
the initial coefficient vector w and the inverse matrix
of R. If there are some a priori information, they can
be used to set the first values of the w vector, if not,
w(0) is set as an array of zeros. Moreover, the for-
getting factor λ has to be chosen. It impacts on the
ability to track the input signal and on the stability
of the filter coefficient. To this aim, λ was empirically
fixed at 0.98. As the number of the processed samples
increases, the effect of this initialization error will de-
crease because of the effect of the weighting factor
λ.
It is not simple to choose the length of data re-
quired for ensuring invertibility of R. The RLS
method uses an approximate initialization, so it does
not require matrix inversion. At k = 0, the coefficient
vector w is inizialized to an array of 0, of the length
3 (the length of each of the three reference channel
was chosen equal to 1). The initial correlation matrix
R
−1
(0) was set equal to the identity matrix of 3 × 3,
because of the channel length of 1 and the use of 3
channels. The trick behind the chosen R
−1
(0) is that
it could be defined as:
R
−1
(0) = δI (16)
where δ is the regularization parameter, to which
should be assigned a small value for high signal-to-
noise ratio (SNR) and a large value for low SNR,
which may be justified on regularization grounds
(Haykin S.).
To sum up, Alg. 1 presents the pseudocode of this
method, where the invR, R
−1
(k), is the result of the
combination of the past invR, R
−1
(k − 1). Moreover,
in the case of multireference adaptive filter, the error
vector E is the result of the difference between d, the
raw EMG signal, that presents the signal of interest
and the noise, and the scalar product of the coefficient
vector w and the three reference signals x.
Before feeding the signals to the multi-reference
RLS adaptive filter, they have been high-pass filtered
in order to remove large baseline wandering artifacts.
To this aim, a linear-phase equiripple finite impulse
response (FIR) filter (order 1124, 80 dB attenuation)
with a cut-off frequency of 5 Hz was designed. Be-
ing an offline processing, no special care was paid to
the filter order, preferring to achieve a linear phase
response associated with filter causality.
Even though the adaptive filter is able to cancel
the whole ECG interference, not only the QRS com-
plexes, their attenuation can be used to evaluate the
cancellation performance, since it is the highest com-
ponent of the ECG signal.
BIOSIGNALS 2018 - 11th International Conference on Bio-inspired Systems and Signal Processing
164