Signal Averaging
Signal Averaging
net/publication/230965838
CITATIONS READS
89 9,292
2 authors:
All content following this page was uploaded by Umer Hassan on 25 June 2015.
This content has been downloaded from IOPscience. Please scroll down to see the full text.
(http://iopscience.iop.org/0143-0807/31/3/003)
View the table of contents for this issue, or go to the journal homepage for more
Download details:
IP Address: 130.126.162.126
This content was downloaded on 16/03/2015 at 19:15
Abstract
This paper describes theory and experiments, taken from biophysics and
physiological measurements, to illustrate the technique of signal averaging. In
the process, students are introduced to the basic concepts of signal processing,
such as digital filtering, Fourier transformation, baseline correction, pink and
Gaussian noise, and the cross- and autocorrelation functions. From these
computations, the students estimate physically interesting parameters such as
the pulse rate and blood flow velocity. They also learn about some of the pitfalls
encountered in quantifying the signal and noise components for a meaningful
computation of the signal-to-noise ratio.
(Some figures in this article are in colour only in the electronic version)
1. Introduction
In experimental science, a situation often arises where the response to some stimulus is very
weak or the measurable signal is exceedingly small, swamped by unwanted noise [1]. In
experimental physics, there are many practical examples in which one may come across
with this type of signal. A good example is that of a biophysical experiment in which we
are interested in measuring the response of a nerve or muscle cell to an electrical stimulus.
Another example appears in nanotechnology research where one is required to measure the
resistance, say, of a gold nanowire, which is very small. A similar situation arises in NMR
spectroscopy when the spectral peaks from the natural abundance carbon-13 nuclei are too
small to manifest themselves in a single experiment. Thus, understanding the concept of noise
and methods of reducing noise while accentuating the signal is very important for any serious
student in the field of experimental physics.
There are many procedures to reduce the noise. When the response of the system is
periodic, it is possible to reduce the noise and enhance the signal using the statistical technique
of signal averaging [2]. This paper is a pedagogical illustration of signal averaging, and
0143-0807/10/030453+13$30.00
c 2010 IOP Publishing Ltd Printed in the UK & the USA 453
454 U Hassan and M S Anwar
0.04 z1 z2 z3 z4
0.02
M pointss
Amplitude (Volts)
v(k)
0.02
0.04
0.06
Superposition
0.08
0 200 400 600 800 1000 1200 1400
Number of Samples
Figure 1. Time series of a noisy signal comprising the partitions labelled as z and each partition
comprising M points.
aims to demonstrate the power of this technique by its application to two biomedical signals
[3, 4] obtained using pulse oximetry and the electrocardiogram setups. En route, students learn
about various concepts in signal processing and low-level measurements. After a theoretical
preparation, the students are introduced to the concepts of the signal-to-noise ratio, Fourier
transformation, cross- and autocorrelations and digital filtering. The analysis of biomedical
signals also lends meaningful interpretations of the Fourier spectrum and the cross-correlation
function, which are used to calculate blood flow speeds and pulse rates.
2. Theory
4 4 4
(a) (b) (c)
2 2 2
Amplitude (V)
Amplitude(V)
Amplitude(V)
0 0 0
2 2 2
4 4 4
0 10 20 30 40 0 10 20 30 40 0 10 20 30 40
No of samples No of samples Number of Samples
1 1 1
Arb. Units
Arb. units
0.6 0.6 0.6
0 0 0
0 100 200 300 400 500 0 200 400 600 0 200 400 600
Frequency (Hz) Frequency (Hz) Frequency (Hz)
Figure 2. (a) Signal with white Gaussian noise before averaging. (b) Signal after averaging for
400 scans or partitions. (c) A perfect signal without noise. (d) Frequency response of the noisy
signal before averaging. (e) Frequency response after averaging the noisy signal. (f) Frequency
response of a prefect signal.
[5, 6]. Thus, after performing signal averaging, one expects from equation (1) that the output
is
y(k) = v(k) = vs (k) + vnoise (k) = vs (k). (3)
The simple averaging technique described above has a number of limitations. For example,
the acquired signal may comprise a time-independent offset originating from the measurement
circuit; in this case the condition vnoise = 0 does not hold. This offset can be eliminated
by simple subtraction. Furthermore, the signal may also comprise a time-dependent ‘drift
voltage’ that is mainly dependent on temperature changes and drifting voltage biases in the
amplifiers used in the circuit [7]. Averaging works only if these drifts are properly accounted
for.
In addition to white noise, there are other types of noise that are commonly encountered
including ‘pink noise’. Signal averaging does not correct for pink noise, as we will demonstrate
later. The frequency response of pink noise [6] goes approximately as 1/f . Considering pink
noise is especially important while analysing biomedical signals since it is present in many
biological systems, e.g. in heart beat rhythms, current flow in ion channels and statistics of
the DNA sequences [8].
2.1. Example
Students can use a simple example to analyse the effect of averaging when the signal is
contaminated by Gaussian and low-frequency pink (1/f ) noises. The computer codes are
available from our website [9]. In one of the examples, Gaussian white noise with standard
deviation 0.8 V is added to a clean square wave of amplitude 2 V and frequency 50 Hz.
Averaging is performed by taking two periods in one partition. Figure 2 shows the noisy
signal along with the frequency spectrum before and after averaging, the latter obtained using
Matlab’s routine for fast fourier transformation fft(). The figure clearly shows the effect
456 U Hassan and M S Anwar
0 4
(a) (b)
2
−10
Amplitude(V)
Amplitude(V)
0
−20
−2
−30
−4
−40 −6
0 10 20 30 40 0 10 20 30 40
No of samples No of samples
1 1
(c) (d)
0.8 0.8
Arb. Units
Arb. Units
0.6 0.6
0.4 0.4
0.2 0.2
0 0
0 200 400 600 0 200 400 600
Frequency (Hz) Frequency (Hz)
Figure 3. (a) Signal with pink noise before averaging. (b) Signal after averaging for 400 scans.
(c) Frequency response of the noisy signal before averaging. (d) Frequency response of the noisy
signal after averaging.
of signal averaging in reducing noise. The signal-to-noise ratio is visually enhanced and the
spectrum also has smaller power inside the unwanted frequency components. For comparison,
the spectrum of a clean noiseless square wave is also shown in the figure.
The averaging procedure, however, works differently for pink noise. As figure 3 shows,
averaging does not result in the effective recovery of the signal: the procedure allows smaller
frequencies to overwhelmingly creep into the spectrum and hence distorts the waveform.
The preceding example shows that averaging is acting like a frequency transformation,
selectively allowing the lower frequency components to pass through. The averaging filter
that is mathematically described in equation (2) admits an impulse response h(k) [5]:
N
i=1 δi (k)
h(k) = , (4)
N
δ(0) + δ(M) + δ(2M) + · · · + δ(M(N − 1))
h(k) = . (5)
N
Here, once again, M is the total number of samples in one partition and N is the total number of
overlaid partitions. Since the Fourier transform of the impulse δ(M) is e−iωM , the frequency
response becomes [5]
1 + e−iωM + e−iω2M + · · · + e−iωM(N−1)
H (eiω ) =
N
1 1 − e−iωMN
= . (6)
N 1 − e−iω
Figure 4 plots the (real part of the) frequency response for different values of N. It is quite
evident that the averaging process behaves as a low-pass filter, removing the higher frequency
Reducing noise by repetition 457
0.9 (a)
(b)
0.8 (c)
0.7
0.5
0.4
0.3
0.2
0.1
0
0 0.1 0.2 0.3 0.4 0.5
Frequency in pi units
Figure 4. Frequency response of an averaging filter for (a) 10 scans, (b) 25 scans and (c) 50 scans.
components from the noisy signal. As we increase the value of N, overlaying more and
more partitions, the cutoff of the filter also decreases, allowing only the smallest frequency
components that are present within the bandwidth to pass through. In the context of white
noise filtering, this means that the total noise output power will be reduced.
Signal averaging increases the signal-to-noise ratio. Students can readily appreciate this fact
through a simple and well-known argument. Suppose the noisy signal v(k) is sampled every
T s:
v(kT ) = vs (kT ) + vnoise (kT ). (7)
If N partitions are composed, the averaged signal becomes
N
N
y(kT ) = vsi (kT ) + i
vnoise (kT ), ∀ k = 1, 2, . . . , M. (8)
i=1 i=1
If the partitions are perfectly aligned and the signal is truly periodic, the desired signal adds
up:
N
vsi (kT ) = N vs (kT ). (9)
i=1
However, for Gaussian noise with zero mean and a standard deviation σn (which also equals
its rms value), we obtain
N √
i
vnoise (kT ) = N σn2 = N σn . (10)
i=1
Taking the ratio of (9) and (10), we can find the signal-to-noise ratio (SNR) after averaging N
partitions:
N vs (kT ) √
SNRN = √ = N × SNR1 . (11)
N σn
√
Thus, we get an N improvement in the SNR.
458 U Hassan and M S Anwar
10 4
(a) (b)
5 2
Amplitude(V)
Amplitude(V)
0 0
−5 −2
−10 −4
0 50 100 0 50 100
No of samples No of samples
1 1
Arb. Units
0.6 0.6
0.4 0.4
0.2 0.2
0 0
0 500 1000 1500 2000 0 500 1000 1500 2000
Frequency (Hz) Frequency (Hz)
Figure 5. (a) Noisy signal before averaging. (b) Signal after averaging. (c) Frequency spectrum
before averaging. (d) Frequency spectrum after averaging.
Supposing that the signal v is periodic with a discrete period M, we can define the
autocorrelation G (l) by considering just a single period (which is also a partition in our
parlance). The autocorrelation is defined as
1
M
G(l) = v(k)v(l + k) (12)
M k=1
1
M
= (vs (k) + vn (k))(vs (l + k) + vn (l + k)). (13)
M k=1
If
Mthe noise is Gaussian, M the signal and noise will be uncorrelated and the terms
k=1 vn (k)vs (l +k) and k=1 vs (k)vn (l +k) will be zero. Therefore, prior to signal averaging,
the autocorrelation is
M
1 M
G(l) = vn (k)vn (l + k) + vs (k)vs (l + k) . (14)
M k=1 k=1
M
The term k=1 vn (k)vn (l +k) represents the autocorrelation of band-limited Gaussian noise and
its value depends upon the bandwidth. The higher the bandwidth, the higher the frequencies
present in the noise, leading to rapid variations in the noise and admitting a narrower
autocorrelation function [10]. After performing signal averaging, which acts as a low-pass
filter, the higher frequencies are removed. The correlations within the noisy components now
extend over greater spans of time; thus, the autocorrelation function broadens.
This behaviour is exemplified through a straightforward simulation. Gaussian white noise
of standard deviation 1.5 V is added to a sine wave of amplitude 2 V and frequency 100 Hz.
Signal averaging is performed on this noisy signal. Figure 5 shows the noisy signal and its
frequency spectra before and after averaging with 10 000 repetitions.
Reducing noise by repetition 459
Autocorrelation (arb.units)
Autocorrelation (arb.units)
1 1
X (a) (b)
0.5
0.5
0
0
−0.5
−0.5 −1
−100 −50 0 50 100 −100 −50 0 50 100
Lag variable, l Lag variable, l
1 1
Arb. Units
0.6 0.6
0.4 0.4
0.2 0.2
0 0
0 1000 2000 3000 0 1000 2000 3000
Frequency (Hz) Frequency (Hz)
Figure 6. Normalized autocorrelation (a) before averaging and (b) after averaging. Frequency
transform of the autocorrelation (c) before averaging and (d) after averaging.
1 1
(a) (b)
Autocorrelation (arb.units)
Autocorrelation (arb.units)
0.8 0.8
0.6 0.6
0.4 0.4
0.2 0.2
0 0
−10 0 10 −10 0 10
Lag variable, l Lag variable, l
Figure 7. Normalized autocorrelation plot (a) before averaging and (b) after averaging.
For demonstrating the power of signal averaging, we present the results for two biophysical
signals: the oxygen saturation rhythms in the pulse (oximetry) and the electrical rhythm
of the heart (ECG). Signal averaging requires a perfect overlay of the partitions and
hence it is usually employed for periodic or repetitive signals. On the other hand,
most physiological signals (such as the electrocardiogram (ECG), electroencephalogram
(EEG), phonocardiogram (PCG) and pulse oximetry) are only quasi-periodic. In fact, the
460 U Hassan and M S Anwar
Current to Voltage
Convertor
RED LED Photo
Diode
Output Voltage
Output Voltage
IR LED
beat-to-beat variability is often used as a powerful prognostic tool for determining the
predisposition to various illnesses. For performing averaging on these quasi-periodic signals,
one needs to make certain approximations. The procedure that has been adopted in this
demonstration is very simple. We use a standard QRS detection algorithm to detect the
positions of the R peaks in the ECG signal [7] and a derivative-based method for marking the
maxima of the pulse oximetry signal [7]. We find the maximum interval between two peaks
over the entire set of data and zero-pad the remaining partitions to bring all of them to the
same length. Finally, we overlay the equal-length partitions and perform the averaging. The
entire procedure is done offline, but a suitable refresh rate of, say, 10 s can be set after which
the averaging algorithm resets.
Figure 8 shows the setup to observe the pulse oximetry signal in which light of a particular
wavelength, originating from light-emitting diodes, transmits through the finger tip and optical
sensors are placed on the other side to detect the absorbed light intensity [11]. The intensities
detected by the two photosensitive detectors are the noisy signals we average. The oxygenated
haemoglobin in the blood has a higher absorption coefficient for the infrared (IR) wavelength
and the deoxygenated haemoglobin has the higher absorption coefficient for red. Thus, by
taking the ratio of the absorbed IR light to the absorbed red light, one can also calculate the
oxygen saturation level [11].
A quantification of the SNR requires that students are able to identify the noise and signal
parts. The resultant signal is a point-by-point sum of the signal and the noise components
and is shown in figure 9 by the label ‘noisy output signal’. So how does one perform the
quantification? The noise can be quantified by disengaging it from the signal, for example,
by taking the optical sensor far away from the light source. The output of the detector is then
pure noise.
There are several methods by which we can quantify the signal. The most straightforward
approach is to take the maximum point in the signal. However, this is not optimal as the
maximum may come from a noisy ‘spike’ or the finite digitization of the signal may even miss
the true maximum altogether. A more reasonable approach is to measure the area under the
positive part of the curve. If the output of the circuit is baseline adjusted, the noise will assume
Reducing noise by repetition 461
0.2
Noisy output
0.15 signal
Noise
0.1
−0.05
−0.1
−0.15
−0.2
0 200 400 600 800 1000 1200 1400 1600 1800 2000
Number of Samples
Figure 9. Pulse oximetry signal showing the noisy signal part and the noise; the latter is obtained
by taking the photodetector far away from the LED.
both positive and negative values and so its contribution to the signal area will be minimized.
Likewise, one can evaluate the sum of the squares of the same number of samples in the pure
noise part, thus obtaining the noise power. The ratio of the signal area to the noise power is
one reasonable measure of the SNR.
Figure 10 shows the results when the baseline-corrected noisy signal is averaged over 50, 250
and 500 repetitions and the resulting SNR, calculated from the ratio of the signal area to the
noise power, is 6.8, 15.6 and 22.1 respectively. Not only does averaging visually improve the
signal, one can also verify the promised square root enhancement in the SNR, as shown in
figure 11.
Figure 12 shows the frequency content of the signal with and without averaging. As expected,
averaging diminishes the high-frequency components. From the frequency spectrum, one can
also estimate the pulse rate. As depicted in figure 12, the frequency peak is at 1.172 Hz, so
the pulse rate is about 70 min−1.
3.5. Using correlation data for estimating the blood flow velocity
The blood speed in the capillaries of the fingers is about 1–5cm s−1 . Our setup allows us
to measure this velocity. Furthermore, we can also demonstrate a useful application of the
concept of the correlation function and how it is affected by the averaging process. The IR
and red LEDs are placed at an approximate distance x of 4 cm. Let f (n) be the discrete signal
from the IR LED and g(n) be the discrete signal obtained from the red LED, both comprising
462 U Hassan and M S Anwar
0.2 0.1
0 0
−0.1 −0.05
−0.2 −0.1
0 200 400 0 200 400
Number of Samples Number of Samples
0.1 0.1
Signal Amplitude (Volts)
0 0
−0.05 −0.05
−0.1 −0.1
0 200 400 0 200 400
Number of Samples Number of Samples
Figure 10. (a) Baseline-corrected signal before averaging. (b) Averaged signal for 50 repetitions,
(c) 250 repetitions and (d) 500 repetitions.
24
Experimental Values
22
curve Fitted
20
18
Square Root (n)
16
14
12
10
6
50 100 150 200 250 300 350 400 450 500
Number of repetitions, n
√
Figure 11. Verifying the N improvement in the SNR as the number of repetitions N is increased.
M sample points within a partition. The cross-correlation S(l) between the IR and red signals
can be computed as
M−1
S(l) = (1/M) f (n) g(l + n). (15)
n=0
The cross-correlation function S(l) reveals how the red signal at the discrete time (l + n) is
related to the IR signal at the discrete time n. The time lag l0 at which the cross-correlation S(l)
achieves its maximum value is the time it takes for blood to traverse the distance x, therefore,
providing an estimate of the flow speed. For example, we acquire the IR and red signals,
Reducing noise by repetition 463
1 1
X: 1.172 X: 1.172
Y: 1 (a) Y: 1 (b)
0.8 0.8
Arb. Units
Arb. Units
0.6 0.6
0.4 0.4
0.2 0.2
0 0
0 1 2 3 4 5 0 1 2 3 4 5
Frequency (Hz) Frequency (Hz)
Figure 12. Frequency response of the pulse oximetry signal (a) without averaging and (b) with
averaging.
1 1
X: 3.636 (a) X: 1.481 (c)
Y: 1 Y: 1
0.9 (b) 0.9 (d)
Cross Correlation (arb. units)
0.8 0.8
0.7 0.7
0.6 0.6
0.5 0.5
0.4 0.4
0.3 0.3
0.2 0.2
0 2 4 6 8 0 1 2 3
Time (sec) Time (sec)
Figure 13. Normalized cross-correlation plot between IR and RED LED signals (a) before running
and without averaging, (b) before running with averaging, (c) after running and without averaging
and (d) after running with averaging.
and compute the cross-correlation between them, without and with averaging (represented in
figures 13 (a) and (b)). The maximum value is at the physical time t = lo T = 3.636 s where
T is the sampling interval. Thus, the blood speed is x/t = 1.1 cm s−1 . After our subject was
made to run vigorously, we obtained the correlation functions depicted in figures 13(c) and
(d) with the maximum t = 1.481 s; the blood speed almost doubles and is estimated to be
2.7 cm s−1 .
It is also clear from these plots that the signal averaging increases the width of the
correlation function. The red signal g(n) can be approximated as a rescaled copy of the IR
signal, g(l + n) = βf (n + l), where β represents the relative efficiency of the red and IR
signals and their detection; therefore, the above discussion on the effects of averaging on
autocorrelation also applies to the present case.
Students can also appreciate the signal-averaging technique by applying the concept to the
noisy ECG signal. The most prominent and diagnostically important part of the ECG is the
QRS complex [7], which may become completely obscured in the presence of excessive noise;
464 U Hassan and M S Anwar
−3
x 10
5
Amplitude (Volts)
(a)
−5
0 100 200 300 400 500 600 700 800 900 1000
Nmber of Samples
−3
x 10
10
Amplitude (Volts)
(b)
5
−5
0 100 200 300 400 500 600 700 800 900 1000
Nmber of Samples
−3
x 10
10
Amplitude (Volts)
(c)
5
−5
0 100 200 300 400 500 600 700 800 900 1000
Nmber of Samples
Figure 14. (a) Baseline-corrected signal before averaging. (b) Averaged signal for 50 repetitions,
and (c) 500 repetitions.
luckily the averaging technique can recover the waveform. The simplest ECG circuits which
can readily be built in most undergraduate laboratories have been widely discussed [3, 4].
Figure 14 shows the results of the ECG signal obtained from a simple circuit [9]. The noise
offset voltage present in the acquired signal which arises due to the electronic amplifiers used
in the circuit is −0.013 V and is removed by baseline correction. There is no voltage drift in the
ECG signal, since it is taken care of by providing necessary bias voltage to the instrumentation
amplifier and there are no slow temperature variations for the data that are acquired for a very
short time. Figure 14 shows the results of the ECG signal obtained before and after averaging.
The input signal is noisy and it is impossible to identify the QRS complex, but averaging over
50 and 500 repetitions reveals the complex structure.
4. Conclusions
The paper gives a pedagogical illustration to the concept of signal enhancement or noise
reduction by using the technique of signal averaging. The signals we have chosen are
physiological signals often encountered in a course on biomedical engineering or biophysics.
Hopefully, these signals have a role to play in arousing the physics student’s interest in
measurement and instrumentation and will open the doors to basic signal processing tasks
such as baseline correction, digital filtering, Fourier transformation and computing the cross-
and autocorrelation functions.
Reducing noise by repetition 465
References
[1] Hudgings D W and Gragt A J 1972 Signal averaging at modest cost Am. J. Phys. 40 1206–12
[2] Kraftmaker Y 2006 Noise reduction by signal accumulation Phys. Teach. 44 528–30
[3] Carr J J and Brown M J 2001 Introduction to Biomedical Equipment Technology (Singapore: Pearson Education)
[4] Willis Tompkins J 1995 Biomedical Digital Signal Processing (India: Prentice-Hall)
[5] Proakis J G and Manolakis D G 2006 Digital Signal Processing: Principles, Algorithms, and Applications
(Delhi: Prentice Hall, Pearson Education)
[6] Wilmshurst T H 1990 Signal Recovery from Noise in Electronic Instrumentation (Serbia: Institute of Physics)
[7] Rangayyan R M 2002 Biomedical Signal Analysis (New York: Wiley)
[8] Antal T, Droz M, Györgyi G and Rácz Z 2001 1/f noise and extreme value statistics Phys. Rev. Lett. 87 240601
[9] http://physlab.lums.edu.pk/index.php/Classroom Demonstrations
[10] Hassan U, Shamim S and Anwar M S 2009 Investigating properties of white noise in the undergraduate
laboratory Eur. J. Phys. 30 1143–1151
[11] Gibson A P, Chandra E and Chandra M 2009 Pulse oximetry as a medical physics practical on school trips
Phys. Educ. 44 577–81