SSP-5-1 Adaptive Filtering
SSP-5-1 Adaptive Filtering
Sverre Holm
Optimal and adaptive filters
1. Optimal vs conventional filtrering and
applications of adaptive filter 5-18
04.04.2022 2
IN3190
IN3190
Literature
Diniz, Adaptive Filtering Algorithms and Practical Implementation 5th Ed
https://link.springer.com/book/10.1007/978-3-030-29057-3
– Ch 2.4 Wiener filter (p. 26-30)
– Ch 2.6-9 MSE Surface, Steepest Descent (p. 35-41)
– Ch 2.10 Applications revisited (p. 41-52)
– Ch 3-1-3.4, 3.6-3.7 (p. 61-74, 75-97)
– Ch 4.4 The Normalized LMS (p. 114-115)
IN3190: Rao & Swamy, Digital Signal Processing, Theory and Practice
https://link-springer-com.ezproxy.uio.no/book/10.1007/978-981-10-8081-
4, Chapter 11: Adaptive Digital Filters
– 11.1-11.4 FIR Adaptive Filters, LMS, NLMS. [RLS]
– 11.5 Comparison, Convergence of LMS: result given but not derived
– 11.6 Applications: ECG, Echo Cancellation
04.04.2022 3
IN3190
IN3190
Literature
Monson H. Hayes: Statistical Digital Signal Processing and Modeling
• Chapter 7: Optimum Filters
– 7.1 Introduction (p. 335 -
– 7.2 The FIR Wiener Filter (- p. 353)
• Mainly 7.2.1 Filtering & 7.2.3 Noise Cancellation. Little emphasis on 7.2.2 & 7.2.4
04.04.2022 4
Optimal and adaptive filters
1. Optimal vs conventional filtrering and
applications of adaptive filter
2. Optimal (Wiener) filtering: stationary case
3. Adaptive filtering with the Least-Mean-
Squares algorithm
4. Convergence properties of LMS
5. Variants and alternatives to LMS
04.04.2022 5
Elektrokardiogram (EKG)
• http://www.atenmedical
art.com/anim/heart.htm Images: Wikipedia
04.04.2022 6
Noise filtering of EKG signal
• Matlab: Aase.m
• Ottar Aase,
• Kardiologi, Ullevål
Universitetssykehus
04.04.2022 7
Time and frequency analysis
04.04.2022 8
EKG: Filter for noise reduction
04.04.2022 9
EKG: Before and after filterring
04.04.2022 10
Optimal – conventional filtrering
• Optimal filtering
– Signal and noise overlap
• Wiener filter
– Filter requirements and noise
spectrum may vary with time
• Adaptive Wiener filter
• Conventional filtering
– Analog or digital
• Usually a digital filter
04.04.2022 11
Filtering
• Conventional filter (FIR, IIR)
– Separate frequency bands
• Optimum filter (Wiener filter)
– Minimum error relative to reference
– Adaptive filter = Time-varying Wiener filter
• Matched filter
– Best signal to noise ratio
– Sonar, radar: correlate with reverse of sent
waveform
04.04.2022 12
Adaptive filter
04.04.2022 13
Examples – adaptive filtering
Removal of tone from a broadband signal
Unwanted carrier on a short wave link:
“HF SSB automatic notch filter example #1”
• Removal of broadband noise from a broadband signal
– Atmospheric noise that disturbs the shortwave link:
”HF SSB noise reduction example #1”
– VHF FM link which is close to lower SNR limit for useability:
”2 meter FM noise reduction example #1”
– VHF FM weather service close to SNR threshold:
”VHF FM (NOAA weather) noise reduction example #1”
04.04.2022 15
Echoes: signal processing and
psychoacoustics
• 0.1-10 ms: Comb filter (D = 0.25 ms)
– Additive 1/0.25 = 4 kHz (3600)
– Subtracts at 2 kHz (1800)
– Flanging: time-varying comb filter
• 10-50 ms: reverberation – creates ’volume’
• > 50 ms: Discrete echoes
• 138 ms: radio signal around the world (shortwave):
– LA3ZA: Three paths from Japan to Norway along the grayline
• ~200 ms: unpleasant, causes stuttering
– Kurihara, T "A System Utilizing Artificial Speech Disturbance with Delayed Auditory Feedback“,
ArXiv, 2012
• 480 ms:
– Geostationary satellite: 4*36000 km/3e5
04.04.2022 16
Echo cancellation in telephone
• One adaptive filter, AF, on each side
• An estimate of the echo, y^k is made from the
incoming signal, xk. Then it is subtracted
• Minimizing the output ek
input
reference
04.04.2022 17
Speaker phone (~any mobile phone)
• Acoustic coupling between
loudspeaker and
microphone
• May use PTT – Push to
Talk, but that does not
give full duplex
• Typically 512 tap filters
– Important with a fast
algorithm
• Tele conference reference
– Larger distance microphone -
loudspeaker
– Must avoid positive feedback
(howling)
– 250-1000 taps dependent on
the size of the room, fast input
convergence
04.04.2022 18
Optimal and adaptive filters
1. Optimal vs conventional filtrering and
applications of adaptive filter
2. Optimal (Wiener) filtering: stationary case
3. Adaptive filtering with the Least-Mean-
Squares algorithm
4. Convergence properties of LMS
5. Variants and alternatives to LMS
04.04.2022 19
Wiener filter
x(n)=d(n)+v(n)
04.04.2022 20
Wiener filtering
• Clean up desired signal, d(n), contaminated by
noise, v(n): x(n)=d(n)+v(n)
• Wiener filter, W(z):
– In: x(n)
– Out: d^(n)
– Criterion: Min E[|e(n)|2], e(n) = d(n) - d^(n)
• Related to Kalman filter:
– Wiener filter: LTI filter for stationary processes
– Kalman filter: time-varying, also applicable to nonstationary
processes
• Ch. 7.1-7.2.1 in Hayes: Statistical digital signal
processing and modeling
04.04.2022 21
Wiener filter
• p’th order FIR:
• Output:
• Minimize:
04.04.2022 22
Theorem –
2.3.10 Optimization Theory
04.04.2022 23
Othogonality principle
• Derivative = 0 (e is a function of w, e* of w*):
Wiener-Hopf
: estimator
• In matrix form:
• or:
04.04.2022 28
04.04.2022 29
Wiener filter – frequency domain
• Wiener-Hopf: w(k) * rx(k) = rdx(k)
04.04.2022 30
Wiener filter – frequency domain
• Additive uncorrelated noise: x(k)=d(k)+v(k)
– Px(w) = Pd(w) + Pv(w)
– Pdx(w) = Pd(w): uncorrelated signal, x, and noise,v
• Wiener filter:
– W(w) = Pdx(w) / Px(w) = Pd(w) / [Pd(w) + Pv(w)]
• Interpretation:
– High SNR: Pv(w) → 0 => W(w) → 1
– Low SNR: Pv(w) >> Pd(w) => W(w) → 0
04.04.2022 31
AR(1) process in noise
04.04.2022 33
Different from Matched filter
• Transmit s, receive x=s+v (radar, …)
• Optimal linear filter for max SNR in additive noise:
– Convolve received signal with a conjugated time-reversed template
– y=h*x, where h(t) = s*(t-T)
• SNR increases by TB (time-bandwidth product)
• For radar & sonar which may be peak power limited
• Called ’pulse compression’ in previous exercises
– Linear Frequency Modulation in Exercise II
• Limitation: blind zone of length T (limits use in medical
ultrasound)
• Contrast to Wiener filter which is minimum rms error between
desired signal and estimated signal
04.04.2022 34
Optimal and adaptive filters
1. Optimal vs conventional filtrering and
applications of adaptive filter
2. Optimal (Wiener) filtering: stationary case
3. Adaptive filtering with the Least-Mean-
Squares algorithm
4. Convergence properties of LMS
5. Variants and alternatives to LMS
04.04.2022 35
1975: Adaptive noise cancelling
• Widrow, et al
"Adaptive noise
cancelling:
Principles and
applications,“
Proc. IEEE, pp.
1692-1716, Dec.
1975
• 2020: >5000 citations My project NTNU, 1977: 2 tap analog LMS filter
MC1494 - Four-Quadrant Multiplier x 4
04.04.2022 36
MC1456, 715 HC – Op Amp
Time-varying signal example: Speech
8000
7000
6000
Short-Time Fourier Transform
Framelength 32 ms, Frequency 5000
timeshift 1 ms.
4000
Frequency resolution
1/32 ms = 31.2 Hz 3000
2000
1000
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7
Time
04.04.2022 37
LMS algorithm: Hayes 9.1 – 9.2
• Wiener-Hopf equations:
• Nonstationary signal =>
w(k) → wn(k): time-varying
filter
• Relax the requirement that
w minimize the m.s. error
at each time-instant
• Instead let: wn+1=wn+wn
04.04.2022 38
Desirable properties
1. When signals are stationary, the solution
should converge to the Wiener filter:
04.04.2022 40
Steepest Descent Algorithm
1. Initialize with an initial estimate w0
2. Evaluate the gradient of (n) for wn
3. Update the weight at time n by taking a step
of size : wn+1 = wn- (n)
4. Increment n, go back to 2) and repeat
04.04.2022 41
Gradient
• Assuming that w is complex, the gradient is
the derivative of E{|e(n)|2} w.r.t. w*
• Gradient vector:
(n) = E{|e(n)|2} = E{ |e(n)|2} = E{e(n) e*(n)}
• But
04.04.2022 43
Gradient algorithm and stationarity
• Looks very empirical
• But, for stationary signal, the gradient is:
– E{e(n)x*(n)} = E{d(n)x*(n)} - E{wnTx(n)x*(n)} = rdx –
Rxwn
• Steepest descent algorithm then becomes:
wn+1 = wn + (rdx – Rxwn)
• Stationarity, Wiener-Hopf satisfied wn=Rx-1rdx
• The correction term is 0 and wn+1=wn for all n
04.04.2022 44
Knowing the desired signal, d(n)
• Sometimes hard
• System identification:
– The plant produces d(n)
– Estimate W = a model of
the plant
• Noise cancellation:
– d(n) may be a narrowband
stochastic process
– v(n) may be a wideband
stochastic process with an
autocorrelation that is ≈ 0
for lags > k0
– May use delay >k0 to get a
signal that does the same
job as the desired signal in
the equations
– Achieve decorrelation
04.04.2022 45
Cancellation of periodic noise
• No reference: found from signal
• The M-step predictor structure can
also be seen as a ‘correlation
canceller’. This is because the
output of the prediction filter
consists of the portion of the signal
that is strongly autocorrelated at
delay lag M or greater and this
output is removed from the
received signal.
• By adjusting the lag M, we can
determine what components are
removed and what are preserved.
• Communications on short wave
– Autonotcher: remove sinusoid of
unknown frequency: 24-128 taps
– Typ. M1=63 @ fs=16 kHz 3.9 ms
• http://www.tapr.org/ Estimate of speech
signal = output
“HF SSB automatic notch filter Estimate of d^ -
example #1”
the periodic signal
04.04.2022
Note that output is different from the usual one! 46
Automatic notch filter
• First a 1 kHz signal is
fed to the notcher and
then the frequency is
changed to 2 kHz.
• The LMS filter adapts
in ~40 ms to the new
signal.
• http://www.tapr.org/
• (Leaky LMS)
04.04.2022 47
Removal of broadband noise Estimate of noise –
Estimate of d^ -
• No reference: found from signal the speech signal
• Uncorrelated component is
suppressed
• Correlated signal is kept
– E.g. speech signal
• Cleaning up recordings made in
secrecy
– Forensic signal processing: Recovering speech
that is masked by distortion, bad recording
techniques, background sounds, or other voices.
• Communication over short wave
– Typical parameters:
– Denoiser: 24-128 taps
– M2=1 @ fs=16 kHz 62 s
– The delay is short because we want to reject
those signal components that do not correlate,
i.e. are pure white noise, and pass components
that have small correlation, i.e. speech signal.
– http://www.tapr.org/
• ”HF SSB noise reduction
example #1”
04.04.2022 48
Forensic … https://www.budstikka.no/nyheter/nyheter/avfyrte-
skudd-mot-asker-bolig/s/2-2.310-1.3469135
04.04.2022 49
”Correlation”- filter
|rxx|
Periodic signal
1 sec
04.04.2022 52
Adaptive noise cancellation of
engine noise on sonar
• Cand Scient thesis, Jens
Kristian Haug, Nov. 1995
• Collaboration with FFI
(Norwegian Defense),
Horten
• Sonar’s frequency range:
500-5000 Hz also has
components from the ship’s
own noise
• 1996: 500-1000 Hz were
removed; unusable
• But this info is of particular
interest since it penetrates
deepest into the bottom
• Performed measurements
on board w.r.t. placement of
reference sensor
• Best: in the front of the
engine room J. Haug, T. Knudsen and S. Holm, "Adaptive noise cancellation
of self noise on sonar," in Proc. Nordic Symp. on Physical
Acoustics, Ustaoset, Norway, p. 72, February 1996.
04.04.2022 53
Optimal and adaptive filters
1. Optimal vs conventional filtrering and
applications of adaptive filter
2. Optimal (Wiener) filtering: stationary case
3. Adaptive filtering with the Least-Mean-
Squares algorithm
4. Convergence properties of LMS
5. Variants and alternatives to LMS
04.04.2022 54
Convergence property (9.2.1)
• The algorithm converges for stationary processes
04.04.2022 55
Convergence – stationarity
Rewrite update equation (ideal algorithm, not LMS):
04.04.2022 56
Convergence – stationarity, 2
• Rx = VVH is a correlation matrix: Hermitian and non-negative
definite
– All eigenvalues k ≥ 0
– V may be unitary: V VH = I
• Weight error vector, cn → 0 for stationary signals:
04.04.2022 57
Convergence – stationarity, 3
• Rotated weight error: un = VH(wn-w) = VH cn :
04.04.2022 58
Convergence rate - stationarity
• Weight vector wn = w+cn = w + Vun :
04.04.2022 59
Convergence rate – stationarity, 2
• Step size: 0 < < 2/max
• Convergence given by
04.04.2022 60
Summary – LMS algorithm
• wn+1 = wn + E{e(n)x*(n)}
– The trace of a square matrix is the sum of the elements on the main
diagonal
– Since V is unitary, the sum of eigenvalues = trace
• Wide-sense stationary =>
Rx is Toeplitz and tr(Rx}) = (p+1)rx(0)
• Steepest descent: 0 < < 2/max
• LMS converges in the mean if 0<< 2/[(p+1)E{|x(n)|2}]
• For exercise: Estimate max to get an idea of range of .
04.04.2022 63
Optimal and adaptive filters
1. Optimal vs conventional filtrering and
applications of adaptive filter
2. Optimal (Wiener) filtering: stationary case
3. Adaptive filtering with the Least-Mean-
Squares algorithm
4. Convergence properties of LMS
5. Variants and alternatives to LMS
04.04.2022 64
Variants
• LMS-derivations:
– Normalized LMS
– Leaky LMS
– Single-bit data, error, or both for faster
performance
• Recursive Least Squares
04.04.2022 65
Normalized LMS (1)
• LMS
– wn+1 = wn + e(n)x*(n)
– Convergence for 0 < < 2/[(p+1)E{|x(n)|2}]
• LMS may have gradient noise amplification when
x(n) is large as the step adjustment is proportional to
x(n)
• May be avoided by adjusting depending on the
signal
04.04.2022 66
Normalized LMS (2)
• First: rewrite LMS
• Estimate E{|x(n)|2} by
• Implies
– where the numerator is the power in a p+1 long signal vector
04.04.2022 67
Normalized LMS (3)
• Normalized LMS: replace
by = max /2 = /||x(n)||2 where 0<<2
04.04.2022 69
Simplified correlation for speeding up
the LMS algorithm
• Simplify correlation estimate, e(n)x*(n), by using just a single
bit for one or both. Examples from Matlab filter design toolbox:
– adaptfilt.sd Sign-data LMS FIR adaptive filter algorithm
– adaptfilt.se Sign-error LMS FIR adaptive filter algorithm
– adaptfilt.ss Sign-sign LMS FIR adaptive filter algorithm
– Multiply => either sum or xor operation
– Gabriel, K. (1983). Comparison of three correlation coefficient estimators
for Gaussian stationary processes. IEEE Trans Acoust, Speech, Sign Proc.
04.04.2022 70
Another fast method for correlation
Average magnitude difference function (AMDF):
Estimator:
– Especially well suited for peak finding
04.04.2022 71
Recursive Least Squares - ch 9.4
Wiener – min mean square: (n) =E{|e(n)|2}
• Need correlation and cross-correlation
• LMS: instantaneous values instead:
E {e(n)x*(n-k)} => e(n)x*(n-k)
04.04.2022 72
Recursive Least Squares
• Properties
– Order p2 mults/adds (LMS: order p)
– RLS often converges faster than LMS
– Less sensitive to eigenvalue distribution of
autocorrelation
– RLS is not so good at tracking nonstationary
processes
– No value for to set
04.04.2022 73
Conditions for adaptive filter to work
• Coherence = normalized cross spectrum:
2010
1980
04.04.2022
Generated by Horizons system of JPL,76
Holm, Astrophys. Space Sci., 2015
Global temperature anomaly HadCRUT3 +
speed of center of mass of the solar system
(SCMSS)
04.04.2022 78
Reasons for lack of coherence
1. Independent noise on signal and reference
2. Nonlinear signal path
3. Several signal paths
04.04.2022 79
Coherence: pilot oxygen mask
• Darlington et al "Adaptive
noise reduction in aircraft
communication systems"
IEEE ICASSP, 1985
• Adaptive noise cancellation
only succeeds at low
frequencies
04.04.2022 80
Multiple-input noise canceller
• Could solve the situation where the
coherence is lacking
• Griffiths, L., Adaptive structures for multiple-
input noise cancelling applications, IEEE
ICASSP 1979.
04.04.2022 81
Sub-band adaptive noise canceller
04.04.2022 82
Alternative: Spectral Subtraction
• Spectral Subtraction alternative to LMS
adaptive noise cancelling filter
– Adobe Audition
– Audacity (freeware) – Noise Removal
– Search for «How to remove noise with Audacity»
– Used for cleaning up portions where signal and
noise are overlaid
• Applications:
– Forensic signal processing,
– Broadband noise cancellation e.g. shortwave
communications
04.04.2022 83
Spectral Subtraction
• Basic spectral noise subtraction algorithm
• D(w) = Ps(w) – Pn(w)
D( w ), if D( w ) 0
P (w ) =
'
S
0, otherwise
04.04.2022 84
Modified Spectral Subtraction
• Mod of the basic spectral subtraction algorithm to combat
the musical noise resulting from its implementation:
• D(w) = Ps(w) – αPn(w)
D( w ), if D( w ) βPn ( w )
PS' ( w ) =
βPn ( w ), otherwise
04.04.2022 85
Modified Spectral Subtraction
Ps(w)
D( w ), if D( w ) βPn ( w )
PS' ( w ) =
D(w) = Ps(w) – αPn(w)
βPn ( w ), otherwise
αPn(w), α > 1
Pn(w)
Pn(w), < 1
04.04.2022 86
Spectral Subtraction & Gunshot
Acoustics
04.04.2022 87
Optimal and adaptive filters
1. Optimal vs conventional filtrering and
applications of adaptive filter 5-18
04.04.2022 88