Professional Documents
Culture Documents
Signal Processing
Timothy R. Derrick
1.5
1.0
0.5
Acceleration (gⲐs)
⫺0.5
⫺1.0
⫺1.5
0 0.2 0.4 0.6 0.8 1.0
Time (s)
º Figure 11.1 The digitized discrete representation of the acceleration of the head while running. The signal was sampled
at 100 hertz (100 samples per second).
227
228 Research Methods in Biomechanics ___________________________________________________
Frequency: f
Amplitude: a
Offset: a0
0
c
One hertz (Hz) is equal to 1 cycle per second. For the signal is the amount of time the signal may be
example, the second hand of a clock completes one delayed or time shifted (figure 11.2d).
cycle every 60 seconds. Its frequency is one cycle per Any time-varying signal, h(t), is made up of these
60 seconds, or 1/60 Hz. The frequency of a signal is four characteristics. The following equation incor-
easy to determine in a single sine wave (figure 11.2a), porates each of the four variables:
but more difficult to visualize in noncyclic signals h(t) = a0 + a sin(2ft + ) (11.1)
with multiple frequencies. The amplitude of a signal
quantifies the magnitude of the oscillations (figure but 2f = (because f is in cycles/s or Hz, is in
11.2b). The offset (or direct current [DC] offset or radians per second and there are 2 radians in a
DC bias) represents the average value of the signal cycle), so another way to write this is
(figure 11.2c). The phase angle (or phase shift) in h(t) = a0 + a sin(t + ) (11.2)
2.0
2 ⫹ 20 Hz
1.5
1.0
Magnitude
0.5
0
⫺0.5
⫺1.0
⫺1.5
⫺2.0
0 0.5 1.0 1.5 2.0 2.5
Time (s)
º Figure 11.3 A 2 Hz and a 20 Hz sine wave summed over a 2.5 s period. The offset (a0 ) and angle () are zero for
both waves, and the amplitude is 1.
___________________________________________________________________ Signal Processing 229
The time (t) is a discrete time value that depends The Fourier coefficients can be calculated from
on how frequently the signal is to be sampled. If the the equally spaced time-varying points with the use
sampling frequency is 100 Hz (100 samples/s), then of a discrete Fourier transformation (DFT) algorithm
the sampling interval is the inverse (1/100th or 0.01). (appendix H). Given the Fourier coefficients, the
This means that there will be a sample or datum reg- original signal can be reconstructed using an inverse
istered every 0.01 s. So, t is one of the discrete values DFT algorithm. The DFT is a calculation-intensive
in the set (0, 0.01, 0.02, 0.03, . . . , T). The variable T algorithm. Faster and more commonly used are the
represents the duration of the digitized signal. For fast Fourier transformations (FFTs). An FFT requires
example, by adding the equations for a 2 Hz sine that the number of original data points be a power
wave to a 20 Hz sine wave, the following waveform of 2 ( . . . 16, 32, 64, 128, 256, 512, 1,024, . . . ). If
is created (as illustrated in figure 11.3): this is not the case, the usual method of obtaining a
“power of 2” number of samples is to pad the data
h(t) = sin(22t) + sin(220t) (11.3)
with zeros (add zeros until the number of points is
a power of two). This creates two problems:
FOURIER TRANSFORM
• Padding reduces the power of the signal. Par-
Any time-varying signal can be represented by succes- seval’s theorem implies that the power in the time
sively adding the individual frequencies present in domain must equal the power in the frequency
the signal (Winter 1990). The an and n values may domain (Proakis and Manolakis 1988). When you
be different for each frequency (fn) and may be zero pad with zeros, you reduce the power (a straight line
for any given frequency. at zero has no power). You can restore the original
power by multiplying the power at each frequency by
h(t) = a0 + an sin (2fnt + n) (11.4)
(N + L)/N, where N is the number of nonzero values
By using the cosine and sine functions, this series can and L is the number of padded zeros.
be rewritten without the phase variable as • Padding can introduce discontinuities between
h(t) = a0 + [bn sin(2fnt) + cncos(2fnt)] (11.5) the data and the padded zero values if the signal does
not end at zero. This discontinuity shows up in the
This series is referred to as the Fourier series. The resulting spectrum as increased power in the higher
bn and cn coefficients are called the Fourier coeffi- frequencies. To ensure that your data start and end at
cients. They can be calculated using the following zero, you can apply a windowing function or subtract
formulae: the trend line before performing the transformation.
1T Windowing functions begin at zero, rise to 1 and then
a0 = Ú h( t) dt (11.6) return to zero again. By multiplying your signal by
T 0
a windowing function, you reduce the endpoints to
Ú h(t ) sin ( 2pfn t )dt
2 T
bn = (11.7) zero in a gradual manner. Windowing should not be
T0 performed on data unless there are multiple cycles.
Subtracting a trend line that connects the first point
Ú h( t ) cos (2 pfn t) dt
2 T
cn = (11.8) to the last point can be used as an alternative.
T 0
Here is another way of looking at it: If you want to Most software packages give the result of an FFT in
know how much of a certain frequency (fn) is pres- terms of a real portion and an imaginary portion. For
ent in a signal h(t), you can multiply your signal by a real discrete signal, the real portion corresponds
the sine wave [sin(2fnt)], take the mean value, and to the cosine coefficient and the imaginary portion
multiply it by 2. If you repeat this process for a cosine corresponds to the sine coefficient of the Fourier
wave and then add the squares of the sine and cosine series equation. An FFT results in as many coeffi-
values together, you will get an indication of how cients as there are data points (N), but half of these
much of the signal is composed of the frequency fn. coefficients are a reflection of the other half. There-
This is called the power at frequency fn. fore, the N/2 points represent frequencies from zero
[
bn = 2 ¥ mean h (t ) ¥ cos( 2pfn t) ] (11.10)
4
Impact
line
2
Acceleration (g)
⫺2
Heel
strike
⫺4
0 0.2 0.4 0.6 0.8 1.0
a Time (s)
0.20
Impact
0.15 line
Active
PSD (g2/Hz)
strike
0.10
0.05
0
0 10 20 30 40 50
b Frequency (Hz)
º Figure 11.4 Leg acceleration during running in the (a) time and (b) frequency domains. The time domain graph shows
two ground impacts, whereas the frequency domain graph is for a single stance phase.
___________________________________________________________________ Signal Processing 231
The purpose of this study was to determine the effects of increasing impact shock
levels on the spectral characteristics of impact shock and impact shock wave attenua-
tion in the body during treadmill running. Three frequency ranges were identified in leg
acceleration curves collected during the stance phase of running. The lowest frequen-
cies (4 to 8 Hz) were identified as the active region as a result of muscular activity. The
midrange frequencies (12 to 20 Hz) resulted from the impact between the foot and
ground. There was also a high-frequency component (60 to 90 Hz) resulting from the
resonance of the accelerometer attachment. Because these frequencies all occurred at
the same time, it was impossible to separately analyze them in the time domain. Head
accelerations were also calculated so that impact attenuation could be calculated from
the transfer functions (TFs). TFs were calculated from the power spectral densities at
the head (PSDhead) and the leg (PSDleg) using the following formula:
TF = 10 log10 (PSDhead / PSDleg) (11.13)
This formula resulted in positive values when there was a gain in the signal from the
leg to the head and negative values when there was an attenuation of the signal from
the leg to the head. The results indicated that the leg impact frequency increased as
running speed increased. There was also an increase in the impact attenuation so that
head impact frequencies remained relatively constant.
original signal, each containing different frequencies. Heisenberg’s uncertainty principle (both the time and
We can plot these representations on a three-dimen- frequency cannot be known at a point on the time-fre-
sional (3-D) graph with time on one axis, frequency quency plane). This is essentially a resolution problem
on a second axis, and magnitude on the third (figure that wavelet transformation techniques overcome with
11.5). There are problems with this process that involve the use of variable resolution.
100
º Figure 11.5 A 3-D contour
map of the frequency-by-time
values of a leg acceleration
80 curve during running. The
time domain curve is super-
imposed on the contour.
Frequency (Hz)
0
0 50 100 150 200 250 300
Time (ms)
232 Research Methods in Biomechanics ___________________________________________________
The purpose of this study was to investigate the response of muscle activity in the leg
to different impact forces. A human pendulum apparatus was used to control leg geom-
etry and initial conditions as the pendulum impacted a force platform. The loading rate
was varied by changing the viscoelastic properties of the shoe midsole. Myoelectrical
signals were recorded from the tibialis anterior, medial gastrocnemius, vastus media-
lis, and biceps femoris muscles. These signals were resolved by wavelet analysis into
their magnitudes in time and frequency space. Traditional Fourier transformations are
inadequate to describe a nonstationary signal like the one that would be anticipated
during the impact. Differences occurred in the magnitude, time, and frequency content
of the myoelectric signals during the period from 50 ms before impact until 50 ms after
impact. These differences justified the use of the wavelet technique to accomplish the
decomposition. The authors speculated that the change in myoelectric patterns that
occurred with different loading rates resulted from differences in muscle fiber-type
recruitment. Furthermore, they concluded that the levels of muscle activity adjusted in
response to the loading rate of the impact forces.
2500
2000
Force (N) 1345 N
1500
1000
500
0
0 50 100 150 200 250
Time (ms)
2500
2000
1316 N
Force (N)
1500
1000
500
0
0 50 100 150 200 250
Time (ms)
2500
2000
1344 N
Force (N)
1500
1000
500
0
0 50 100 150 200 250
Time (ms)
º Figure 11.6 A running vertical GRF curve sampled at 1,000 Hz (top), sampled at 50 Hz (middle), and sampled at 50 Hz,
then reconstructed at 1,000 Hz (bottom). The magnitude of the impact peak is identified in each graph. Reconstructing the
signal results in a peak value very close to the original.
the curve must be equal to the last point. Neverthe- oscillations become smaller (damped) the farther
less, the principle of circular continuity goes further: you get from the endpoints, and they become much
The slope of the curve at the start must equal the more evident if derivatives are calculated.
slope of the curve at the end. The slope of the slopes Use the following steps (Derrick 1998) to approxi-
(the second derivative) must also be continuous. If mate circular continuity (see figure 11.7):
you do not have circular continuity and you apply
Shannon’s reconstruction algorithm, you may be • Split the data into two halves.
violating the assumption that only frequencies of • Copy the first half of the data in reverse order
less than half of the sampling frequency are present and invert them. Attach this segment to the front
in the data. Discontinuities are by definition high- of the original data.
frequency changes in the data. If this occurs, you will • Copy the second half of the data in reverse order
see in the reconstructed data oscillations that have and invert them. Attach this segment to the back
high amplitudes at the endpoints of the curve. These of the original data.
234 Research Methods in Biomechanics ___________________________________________________
• Subtract the trend line from the first data point each data point. Thus, the first and last points will
to the last data point. be equal to zero.
If you fail to heed the sampling theorem, you not
Reversal of the first or second half of data is a proce- only lose the higher frequencies, but the frequencies
dure by which the first data point becomes the last above the 1/2fN (half the Nyquist frequency) actually
data point of the segment, the second data point fold back into the spectrum. In the time domain,
becomes the second to last, and so on. Inversion this is referred to as aliasing. An anti-aliasing low-
is a procedure that flips the magnitudes about a pass filter with a cutoff greater than 1/2fN applied
pivot point. The pivot point is the point closest in to a signal before it is analyzed ensures that there is
proximity to the original data. Figure 11.7 shows a no aliasing.
schematic diagram of the data after summing the
front and back segments and before subtracting the
trend line. SMOOTHING DATA
Errors associated with the measurement of a biologi-
Trend line cal signal may be the result of skin movement, incor-
rect digitization, electrical interference, artifacts
from moving wires, or other factors. These errors, or
Back “noise,” often have characteristics that are different
segment from the signal. Noise is any unwanted portion of a
Front waveform. It is typically nondeterministic, lower in
segment amplitude, and often in a frequency range different
from that of the signal. For instance, errors associ-
ated with the digitizing process are generally higher
Original data
in frequency than human movement. Noise that has
º Figure 11.7 Schematic diagram of the procedure used to a frequency different from those in the signal can
ensure that a signal has the property of circular continuity. be removed. If you were to plot the signal and the
signal plus noise, it would look like figure 11.8. The
goal of smoothing is to eliminate the noise, but leave
Step 2 ensures circular continuity at the start of the signal unaffected.
the original data set. Step 3 ensures circular conti- There are many techniques for smoothing data
nuity at the end of the original data set. Steps 2 and to remove the influence of noise. Outlined below
3 together ensure that the slopes at the start and are a number of the most popular. Each has its own
end of the new data set are continuous, but it is still strengths and weaknesses, and none is best for every
possible to have a gap between the magnitude of situation. Researchers must be aware of how each
the first point and the magnitude of the last point method affects both the signal and the noise com-
of the new data set. Step 4 removes this gap by cal- ponents of a waveform. Ideally, the signal would be
culating the difference between the trend line and unaffected by the smoothing process used to remove
2.5
2.0 Signal
1.5 Signal ⫹ noise
1.0
Magnitude
0.5
0
⫺0.5
⫺1.0
⫺1.5
⫺2.0
0 0.5 1.0 1.5 2.0 2.5
Time (s)
the noise, but most smoothing techniques affect the MOVING AVERAGE
signal component to some extent.
A three-point moving average is accomplished by
replacing each data point (n) by the average of
POLYNOMIAL SMOOTHING n – 1, n, and n + 1. A five-point moving average
Any n data points can be fitted with a polynomial of utilizes the data points n – 2, n – 1, n, n + 1, and
degree n – 1 of the following form: n + 2 and results in more smoothing than a three-
x(t) = a0 + a1t + a2t 2 + a3t 3 + point moving average does. Note that there will be
(11.15) undefined values at the start and end of the series.
. . . + an – 1t n - 1
This method is extremely easy to implement but is
This polynomial will go through each of the n data incapable of distinguishing signals from noise. It
points, so no smoothing has been accomplished. will attenuate valid signal components and may not
Smoothing occurs by eliminating the higher-order affect invalid noise components. A better choice is
terms. This restricts the polynomial to lower-fre- the digital filter.
quency changes and thus it will not be able to go
through all of the data points. Most human move- DIGITAL FILTERING
ments can be described by polynomials of the ninth
order or less. Polynomials produce a single set of A digital filter is a type of weighted moving average.
coefficients that represent the entire data set, result- The points that are averaged are weighted by coef-
ing in large savings in computer storage space. The ficients in such a manner that a cutoff frequency
polynomial also has the advantages of allowing you can be determined. In the case of a low-pass filter,
to interpolate points at different time intervals and of frequencies below the cutoff are attenuated whereas
making the calculation of derivatives relatively easy. frequencies above the cutoff are unaffected.
Unfortunately, they can distort a signal’s true shape; The type of digital filter is determined by the fre-
see the article by Pezzack, Norman, and Winter quencies that are passed through without attenua-
(1977)—reviewed in chapter 1—for an example of tion. The following digital filters are all implemented
this technique. In practice, avoid using polynomial in the same manner, but the coefficients are adjusted
fitting unless the signal is a known polynomial. For for a particular cutoff frequency. Signals that are
example, fitting a second-order (parabolic) polyno- band passed or notch filtered are run through the
mial to the vertical motion of the center of gravity filter with both low-pass and high-pass cutoff frequen-
of an airborne body is appropriate. The path of the cies (figure 11.9).
center of gravity during walking follows no known
Type of Filter
polynomial function, however.
Filters can be constructed to attenuate different parts
of the frequency spectrum. One or sometimes two
SPLINES cutoff frequencies are necessary to define which part
A spline function consists of a number of low-order of the frequency spectrum is attenuated and which
polynomials that are pieced together in such a way part is left “as is,” or passed unattenuated.
that they form a smooth line. Cubic (third-order)
and quintic (fifth-order) splines are the most popular • Low-pass: The cutoff is selected so that low fre-
for biomechanics applications (Wood 1980). Splines quencies are unchanged, but higher frequencies are
are particularly useful if there are missing data in attenuated. This is the most common filter type. It is
the data stream that need interpolation. Many tech- often used to remove high frequencies from digitized
niques, such as digital filtering (discussed below), kinematic data and as a digital anti-aliasing filter.
require equally spaced data. Splines do not have this • High-pass: The cutoff is selected so that high fre-
requirement. quencies are unchanged, but lower frequencies are
attenuated. It is used as a component in band-pass
FOURIER SMOOTHING and band-reject filters or to remove low-frequency
Fourier smoothing consists of transforming the movement artifacts from low-voltage signals in wires
data into the frequency domain, eliminating the that are attached to the body (e.g., electromyo-
unwanted frequency coefficients, and then per- graphic [EMG] signals).
forming an inverse transformation to reconstruct • Band-pass: The frequencies between two cutoff
the original data without the noise. Hatze (1981) frequencies are passed unattenuated. Frequencies
outlined how to apply this method for smoothing below the lower cutoff and frequencies above the
displacement data. higher cutoff are attenuated. Such a filter is often
236 Research Methods in Biomechanics ___________________________________________________
Sum of residuals
Threshold
Threshold
2. Adjust the cutoff frequency to reduce “warping” The filter is recursive because previously filtered
that resulted from the bilinear transformation. data—Yn – 1 and Yn – 2—are used to calculate the
filtered data point, Yn.
È wA ˘
W A = tan Í ˙ Yn = C1 Xn – 2 + C2 Xn – 1 + C3 Xn +
ÍÎ 2 ¥ sample rate ˙˚ (11.17)
(11.20)
C4Yn – 1 + C5Yn – 2
3. Adjust the cutoff frequency for the number of This filter is underdamped (damping ratio
passes (P). A pass occurs each time the data are = 0.707) and will therefore “overshoot” and
passed through the filter. For every pass through “undershoot” the true signal whenever there
the data, a second pass must be made in the is a rapid change in the data stream. For more
reverse direction to correct for the phase shift. information, consult the article by Robertson
Increasing the number of passes increases the and Dowling (2003). A critically damped filter
sharpness of the roll-off. can be designed (damping ratio = 1) by changing
WA 2 to 2 in each equation in step 4. The warping
WN = Ê1
4
2 Á ˆ˜
ËP¯
-1 (11.18)
function must also be altered as follows:
WA
WN = (11.21)
4. Calculate the coefficients.
2
Ê 1 ˆ
ÁË ˜
2P ¯
-1
W 2N
C1 = In practice, there is little difference between the
(1+ 2W N + W 2N ) underdamped and critically damped filter. The
2W 2N distinction can be seen in response to a step input
C2 = = 2C 1 (a function that transitions from 0 to 1 in a single
(1 + 2W N + W 2N ) step). The Butterworth filter will produce an arti-
W 2N ficial minimum before the step and an artificial
C3 = = C1 (11.19)
maximum after the step (Robertson and Dowling
(1 + 2W N + W 2N ) 2003).
2(1- W N )
2
It is possible to calculate the coefficients so that
C4 = the filter becomes a high-pass filter instead of a
(1 + 2W + W ) N
2
N low-pass filter (Murphy and Robertson 1994). The
( 2W - W - 1) N
2
N
first step is to adjust the cutoff frequency by the fol-
C5 = = 1– lowing:
(1 + 2W + W ) N
2
N
fs
(C + C + C + C )
1 2 3 4
fc =
2
- fc -old (11.22)
5. Apply the coefficients to the data to implement where fc is the new cutoff frequency, fc-old is the old
the weighted moving average. Yn values are cutoff frequency, and fs is the sampling frequency.
filtered data and Xn values are unfiltered data. The coefficients (C1 through C5) are then calculated
238 Research Methods in Biomechanics ___________________________________________________
in the same way that they were for the low-pass filter errors in digitizing create high-frequency noise
and then the following adjustments are made: that, after double differentiating, dominates true
data history. Removing high-frequency noise prior
c1 = C1, c2 = –C2, c3 = C3, c4 = –C4, and c5 = C5 (11.23)
to differentiation prevents this problem. The bio-
where c1 through c5 are the coefficients for the high- mechanist, however, should be aware of how these
pass filter. The data can now be passed through the smoothing processes affect data so that an appro-
filter, forwards and backwards, just as in the low-pass priate method can be applied without distorting
filter case outlined previously. the true signal.