Appendix B - Digital Signal Processing
Appendix B - Digital Signal Processing
B
Digital Signal Processing
E N D I X
Some important topics in digital signal processing that are particularly relevant to
earthquake engineering are briefly introduced in this Appendix. The objective is to
highlight the important concepts, features, and challenges that may be encountered in
processing real earthquake records and generating artificial earthquake time-histories.
Software packages, such as Matlab, are available to perform many of the essential
tasks in digital signal processing.
B.1 Sampling
Consider a continuous signal X(t) with Fourier transform (spectrum) X( F ). Discretize
it at regular interval of s , i.e., at time instances tn = ns , −∞ < n < +∞. Fs = 1/s
is called the sampling rate. The subscript “s” stands for “sampling”. Hence, a sequence
of discrete values is obtained
568
b.1 sampling 569
X(t) 10 Hz 130 Hz f0 = 70 Hz
1.0
0.5
t
0.0
0.02 0.04 0.06 0.08 0.1
−0.5
−1.0
s = 60
1 = 0.01667 s s s s s
Xs( f )
f
−75 −50 −30Hz −15 10 30 Hz 45 70 105 130
60Hz 60 Hz 60Hz
Figure B.2 Aliasing in sampling (frequency domain).
X( f ) Continuous spectrum
f
f0
fs fs fs fs
f
f0 −2 fs f0 − f s fs f0 fs f0 + f s f0 +2 fs
2 2
fs fs fs fs
Figure B.3 Continuous and discrete spectra.
In general, the phenomenon that a signal appears to have a lower frequency than it
actually has is called aliasing.
Figure B.2 shows aliasing in the frequency domain. It is clearly seen that, when
sampled at 60 Hz, a 10 Hz harmonic is alias of −50 Hz, 70 Hz, and 130 Hz harmonics,
and a −15 Hz harmonic is alias of −75 Hz, 45 Hz, and 100 Hz harmonics.
Equation (B.1.1) further implies that the spectrum of a discrete sequence of sam-
pled values contains periodic replications of the original continuous spectrum. The
period between these spectral replicas in the frequency domain is Fs , and the spectral
replicas repeat throughout the frequency domain. For example, consider a signal with
continuous spectrum as shown in Figure B.3. Suppose that it is sampled at rate Fs . A
harmonic component with frequency F0 will also appear at frequencies . . . , F0 −2 Fs ,
F0 − Fs , F0 + Fs , F0 +2 Fs , . . . as shown, because sampling at rate Fs cannot distinguish
harmonics with frequencies F0 ±K Fs , K = 0, ±1, ±2, . . . . As a result, the continuous
spectrum repeats periodically with period Fs in the discrete spectrum.
If the frequency range of interest is restricted in F F max , it is important to know
what harmonic components will be aliased into this frequency band.
f
−B B
f
fs −B B f
s
2 2
fs fs fs fs
f
−B B
fs fs
2 2
fs fs fs fs
X( f ) Continuous spectrum
Noise Noise
f
−B B
Aliasing Aliasing
f
fs −B B f
s
2 2
fs fs fs fs
the discrete spectrum, and there is no distortion or corruption in the frequency band
−B F B. However, if Fs < 2B, adjacent spectral replicas overlap: portions of the
spectral replicas are combined with the original spectrum, resulting in aliasing errors.
According to the Nyquist-Shannon Sampling Theorem, if the highest frequency
component of interest of a continuous signal is F max , then the signal must be sampled
at rate Fs 2 F max . However, in the following two cases
• the signal is not band-limited having components with frequency beyond F max ,
572 appendix b. digital signal processing
• the signal is band-limited but there are high-frequency noises beyond the band-
limit F max = B,
even when the signal is sampled at rate Fs 2 F max , there will be aliasing errors due to
these high-frequency components or noises, as shown in Figure B.5. To resolve this
problem, the signal should be passed through a low-pass filter to remove components
with frequencies higher than F max before sampling (see Section B.4 for digital filters).
Hence,
T
1
CK = X(t) e−i Kωt dt, (B.2.5)
T 0
T T
2 2 2πK
aK = X(t) cosKωt dt = X(t) cos t dt, (B.2.6)
T 0 T 0 T
T T
2 2 2πK
BK = X(t) sinKωt dt = X(t) sin t dt. (B.2.7)
T 0 T 0 T
which is periodic with period 2T. Then the periodic function F2T (t) can be represented
as a Fourier series
∞
1 ∞
2π 2π
X2T (t) = CK e i K ω̂t = (2TCK ) e i (K ω̂)t , ω̂ = , (B.2.9)
K=−∞ 2π K=−∞ 2T 2T
where
T
1
CK = X2T (t) e−i K ω̂t dt. (B.2.10)
2T −T
2π 2π
Let ω = K ω̂, ω = ω̂ = . When T→∞, ω = →0. The discrete spectrum
2T 2T
becomes continuous, and
∞ +∞
→ and X2T (t) → X(t).
K=−∞ −∞
which result in the Fourier transform (FT) and the inverse Fourier transform (IFT)
∞
X(ω) = F X(t) =
FT X(t) e−i ωt dt, (B.2.11)
−∞
574 appendix b. digital signal processing
+∞
F −1
1
IFT X(t) = X(ω) = X(ω)e i ωt dω. (B.2.12)
2π −∞
Because X( F ) is generally complex, a plot of the modulus X( F ) as a function of
frequency F is called a Fourier amplitude spectrum (FAS).
Using equation (B.2.12), the total energy e of X(t) is given by
+∞ +∞ +∞ +∞
2 1
e=
X(t) dt = X(t) X̄(t)dt = X(t) i ωt
X(ω)e dω dt
−∞ −∞ −∞ 2π −∞
+∞ +∞ +∞
1 i ωt 1
= X(ω) X(t) e dt dω = X(ω) X̄(ω)dω,
2π −∞ −∞ 2π −∞
Parseval’s theorem (B.2.13) states that the total energy e in a continuous signal is the
same whether it is evaluated in the time domain, in terms of X(t), or in the frequency
domain, in terms of X(ω). Parseval’s theorem also describes how the energy in the
2
signal is distributed over the frequency range by the function X(ω) , which is also
called the energy spectral density (ESD) function.
Convolution Integral
Consider the convolution of functions X(t) and Y(t) defined as
+∞
C(t) = X(t) ∗ Y(t) = X(τ ) Y(t−τ ) dτ. (B.2.14)
−∞
Its FT is
+∞ +∞
C (ω) = F
C(t) = X(τ ) Y(t−τ ) dτ e−i ωt dt. (B.2.15)
−∞ −∞
i−
IIFs( F )
− s(t)
III δ( f −n fS )
δ(t −nS)
⇒⇒
t f
S fS =1/S
WT ( f )
WTB(t) T
1
⇒⇒ T sinc(πT f )
t f
−T/2 T/2
−1/T 1/T
WB(t)
B WBB( f )
B sinc(πBt)
1
⇒⇒
t f
−B/2 B/2
−1/B 1/B
Figure B.7 Fourier transform pair of the “box-car” .
Its IFT is
+∞ +∞
C (t) = F
1 1
−1
C (ω) = X(ν) Y(ω −ν) dν e i ωt dω. (B.2.18)
2π −∞ 2π −∞
Letting ω = ν + yields
1 2 +∞ +∞
C (t) = X(ν) Y() e i (ν + )t dν d
2π −∞ −∞
+∞ +∞
1 1
= X(ν) e i ν t dν Y() e i t d = X(t) Y(t). (B.2.19)
2π −∞ 2π −∞
Hence, there are the following FT and IFT pairs for the convolution integrals
a periodic function with period ; in one period −/2 < t < /2, the functions is
−(t) = δ(t). III
III −(t) can be expanded in Fourier series
∞
2π
−(t) =
III CK e i Kωt , ω= , (B.2.22)
K=−∞
where /2
1
CK = · δ(t) e−i Kωt dt = 1. (B.2.23)
−/2
F
Using e i Bt = 2π δ(ω −B), the FT of III −(t) is
+∞ +∞ ∞
i 2πK t/ −i ωt
i−
II(ω) = III
− (t) e −i ωt
dt = e e dt
−∞ −∞ K=−∞
∞
∞
F
2πK
= e i 2π K t/ = 2π δ ω− . (B.2.25)
K=−∞ K=−∞
Hence, the FT of a Dirac comb is another Dirac comb as shown in Figure B.6, with
Fs = 1/s ,
∞
∞
−s(t) = s
III δ(t−ns ) ⇐==⇒ i−
IIs( F ) = 2π δ( F −n Fs ). (B.2.26)
n=−∞ n=−∞
1 −i ω T T
2 ωT
= e 2 − ei ω 2 = ω sin , (B.2.28)
−i ω 2
sinx
where sinc(x) = x is the “sinc” function.
Similarly, consider the “box-car” function in the frequency domain
B B
1, − < F < ,
WB ( F ) =
b 2 2 (B.2.30)
0, otherwise.
Its IFT is
+∞ +B/2
1
WB (t) = WBb ( F ) e i 2π F t d(2πF ) = e i 2π F t dF = B sinc(πBt). (B.2.31)
2π −∞ −B/2
In summary, as shown in Figure B.7, the FT and IFT pairs of the “box-car” are:
T T
1, − <t< ,
WTb (t) = 2 2 ⇐==⇒ WT ( F ) = T sinc(π T F ),
0, otherwise.
B B
(B.2.32)
1, − < F< ,
WB (t) = B sinc(πBt) ⇐==⇒ WBb ( F ) = 2 2
0, otherwise.
Figure B.7 shows that if a signal is of finite duration, then it has infinitely wide spectrum;
whereas if a signal has band-limited spectrum, then it must have infinite duration.
Therefore, it is impossible to have band-limited signals with finite duration.
The FT and IFT defined in equations (B.2.11) and (B.2.12) can be approximated
∞
∞
Xs (ω) = X(t) e−i ωt dt ≈ Xn e−i ωtn s ,
−∞ n=−∞
+∞
1
X(tn ) = Xs (ω) e i ωtn dω,
2π −∞
which result in the discrete-time Fourier transform (DTFT) and the inverse discrete-time
Fourier transform (IDTFT)
∞
DTFT Xs (ω) = s Xn e−i ω · ns , (B.2.34)
n=−∞
+∞
1
IDTFT X(ns ) = Xs (ω)e i ω · ns dω. (B.2.35)
2π −∞
578 appendix b. digital signal processing
Suppose that the discretized sequence is obtained by digital sampling through the
−s(t), where III
Dirac comb III −s(t) is defined in equation (B.2.26), i.e.,
∞
Xs (t) = X(t) III
−s(t) = s X(t) δ(t−ns ). (B.2.36)
n=−∞
Equation (B.2.38) gives the mathematical foundation for Figure B.3 through DTFT.
Because the sampling frequency Fs = 1/s , it is possible to recover X(t) in the fre-
quency band − 12 Fs F 1 Fs .
2 The FT at the following N frequency points are esti-
mated
K N N N
FK = = K F , K =− +1, − +2, . . . , . (B.2.40)
Ns 2 2 2
The upper limit F N/2 = 1/(2s ) = F max , and the Nyquist frequency F Nyquist = 2 F max =
1/s . F = 1/(Ns ) is the frequency resolution.
From equation (B.2.11), the discrete Fourier transform (DFT) is given by
∞
N−1
N−1
X( F K ) = X(t) e−i 2π F K t dt ≈ Xn e−i 2π F K tn s = s Xn e−i 2πKn/N . (B.2.41)
−∞ n=0 n=0
b.2 fourier series and fourier transforms 579
Denote
N−1
XK = Xn e−i 2π Kn/N =⇒ X( F K ) ≈ s XK . (B.2.42)
n=0
Similarly, from equation (B.2.12), the inverse discrete Fourier transform (IDFT) is
+∞
1
N/2
Xn = X(tn ) = X(ω) e i 2π F tn d(2π F ) ≈ X( F K ) e i 2π F K tn F K
2π −∞ K=−N/2
N/2
1 1
N/2
≈ (s XK ) e i 2π Kn/N = XK e i 2πKn/N . (B.2.43)
K=−N/2 N s N K=−N/2
N−1
= Xn e−i 2π(−K)n/N = X−K , K = 0, 1, 2, . . . , N−1, (B.2.44)
n=0
1
N−1
Xn ≈ X e i 2π Kn/N , n = 0, 1, 2, . . . , N−1. (B.2.45)
N K=0 K
The DFT maps N discrete real or complex values Xn , n = 0, 1, . . . , N−1, into N com-
plex numbers XK , K = 0, 1, . . . , N−1, and vice verse for the IDFT.
In summary, a continuous function X(t) sampled at N points can be indexed as
N N N
Xn = X(ns ), n = 0, 1, 2, . . . , N−1, or n = − +1, − +2, . . . , . (B.2.46)
2 2 2
N N N
For K = 0, 1, . . . , N−1, or K = − +1, − +2, . . . , , the DFT is
2 2 2
N−1
N/2
DFT XK = Xn e−i 2πKn/N = Xn e−i 2π Kn/N , (B.2.47)
n=0 n=−N/2+1
N N N
and for n = 0, 1, . . . , N−1, or n = − +1, − +2, . . . , , the IDFT is
2 2 2
1
N−1 N/2
IDFT Xn = X e i 2π Kn/N = 1 XK e i 2π Kn/N . (B.2.48)
N K=0 K N K=−N/2+1
1 1
N−1 N−1 N−1
= XK Xn e−i 2πKn/N = X X̄ ,
N K=0 n=0 N K=0 K K
i.e.,
N−1 2 2
N−1
X = 1 X . (B.2.49)
n N K=0 K
n=0
DFT is usually performed using fast Fourier transform (FFT) algorithms, e.g., MATLAB
function fft(X) computes the DFT of X using a FFT algorithm.
(1)
⇒⇒
t f
− s(t)
III
(2) i−
IIFs( F )
⇒⇒
t f
s fs=1/ s
− s(t)
X(t) III |X(f ) ∗ i−
II s( F )|
(3)
⇒⇒
Aliasing Aliasing
t f
s
−fs/2 fs/2
|WT ( f )|
WTB(t)
(4)
⇒⇒
t f
T −1/T 1/T
− s(t) WT (t)
X(t) III |X(f ) ∗ i−
II s( F ) ∗ WT ( f )|
B
(5)
⇒⇒
t f
− (t)
III F
i−
II F ( F )
(6)
⇒⇒
t f
1/ f f
(7)
⇒⇒
t f
1/ f f
0.8
Hamming
0.6
Triangular
0.4
0.2
Hanning
t
−T/2 0 T/2
30
|W(ω)|
20
Rectangular “box-car”
10 Side lobes
ω
−5 −4 −3 −2 −1 0 1 2 3 4 5
2
log10 |W(ω)| Hamming Hanning
Rectangular “box-car” Triangular
1
1 2 3 4 ω 5
0
−1
−2
−3
−4
−5
Figure B.9 Window functions.
⎧
⎨ 27 − 23 cos 2π t + T , − T <t< T , 4 27π 2 −(Tω)2 sin T ω
50 50 T 2 2 2 2
Hamming
⎩0, otherwise. 25ω (2π )2 −(Tω)2
b.3 digital signal processing 583
From Figure B.8 and the preceding procedure, the following issues and challenges
involved in signal processing can be readily uncovered:
❧ Sampling a signal at intervals of s or at rate Fs results in periodic replicas of
spectrum with period Fs , which in turn results in aliasing errors. As discussed
in Section B.1, if the maximum frequency of interest is F max , then the Nyquist-
Shannon Sampling Theorem requires that Fs 2 F max ; in practice, Fs = 2.5 F max to
3.0 F max is usually taken.
To eliminate aliasing errors, frequency components higher than F max in the signal
should be removed through a low-pass filter.
The objective of applying a filter H(t) to a signal X(t), in the form of (B.4.1), is to make
Y(ω) = H(ω) X(ω) possess some desired frequency characteristics. For example,
• Low-pass filter − removes frequency content of X(t) for F > Fc ;
• High-pass filter − removes frequency content of X(t) for F < Fc ;
• Band-pass filter − removes frequency content of X(t) for F < Fc1 and F > Fc2 ;
• Band-stop filter − removes frequency content of X(t) for Fc1 < F < Fc2 .
In the discrete form Xn = X(ns ), the continuous convolution H(t) ∗ X(t) becomes
∞
Yn = HK Xn−K = HK ∗ Xn . (B.4.2)
K=−∞
M
Yn = HK Xn−K . (B.4.3)
K=−M
M
Yn = HK ∗ Xn = HK Xn−K ⇐==⇒ Ym = Hm Xm , (B.4.4)
K=−M
where Hm and Xm are the DFT of H(t) and X(t), respectively. Hence, Ym = Hm Xm
is the DFT of the filter output.
Consider a low-pass filter with the desired H( F ) given by
1, F < Fc ,
H( F ) = (B.4.5)
0, F > Fc ,
i.e., frequency components with F > Fc are removed. H( F ) given by equation (B.4.5)
is the “box-car” function given by equation (B.2.30); from equation (B.2.32), its IFT
H(t) and the discrete values of Hn are
tn
−0.20 −0.15 −0.125 −0.10 −0.05 0 0.05 0.10 0.125 0.15 0.20
−20
1.0 wnm-blackman
0.8
0.6
0.4
n= −M= −25 n = M=25
0.2
tn
−0.20 −0.15 −0.125 −0.10 −0.05 0 0.05 0.10 0.125 0.15 0.20
100
hnm-blackman = hnm wnm-blackman
tn
−0.20 −0.15 −0.125 −0.10 −0.05 0 0.05 0.10 0.125 0.15 0.20
−20
Gibbs phenomenon H m ( fk ) H( f )
1.0 Transition region
0.8
Transition region
0.6
0.4
H m-blackman ( fk )
0.2
fk
−100 −80 −60 −50 −40 −20 0 20 40 50 60 80 100
The “sinc” function is symmetric about n = 0 and infinite in extent. Suppose only a
finite-length section of Hn is selected as
Hn , −M n M,
Hn =
m
(B.4.8)
0, otherwise,
N/2
M
HK = Hn e−i 2π Kn/N = Hnm e−i 2πKn/N , (B.4.9)
n=−N/2+1 n=−M
1 N N N
H( F K ) = H(K F ) = s HK , F = , K =− +1, . . . , −1, . (B.4.10)
Ns 2 2 2
The results of Hnm and H m ( F K ) are shown in Figure B.10 for sampling interval s = 0.005 s,
duration T = 40 s, N = 8000, F = 1/T = 0.025 Hz, Fc = 50 Hz, M = 25.
It is seen that there are large ripple-like oscillatory errors in H( F K ), known as Gibbs
phenomenon, which increase in magnitude close to the discontinuities at Fc = 50 Hz.
586 appendix b. digital signal processing
which is shown in Figure B.10. The integer n corresponds to discrete time tn = ns .
The resulting filter becomes
B.5 Resampling
Consider a continuous signal X(t) with FT X( F ). It has been sampled with interval s
(sampling rate Fs ) to yield a discrete sequence
☞ It should be noted that the new sampling rate Fs = 1/ s must still satisfy the
Nyquist sampling requirement Fs 2 F max .
where the superscript “d” stands for “downsampling” or “decimation”. The case of
downsampling with D = 3 is illustrated in Figure B.11.
b.5 resampling 587
X d(nds )
Downsampling D =3
ds = Ds
n
0 1 2
X u(nus )
Upsampling U = 2
us = s /U
n
0 1 2 3 4
−∞ n=−∞
∞
∞
X(r s ) δ(r−n D) e−i 2π F · ns ds
d
=
n=−∞ r=−∞
∞
∞
δ(r−n D) e−i 2π F · (r/D)s ds .
d
= X(r s ) (B.5.4)
r=−∞ n=−∞
Note that
∞
1
D−1
δ(r−n D) = e i 2π mr/D , (B.5.5)
n=−∞ D
m=0
which yields
D−1 D
−1
F
Xsd( F ) = Xs F −m Ds = Xs ( F −m Fsd ). (B.5.6)
m=0 m=0
X( f ) Continuous spectrum
f
−B B
f
−B B
fs fs
D=3
f
−B B
fsd fsd fsd /
fsd = fs D fsd
Xsu( f ) Upsampling
U=2
f
−B B
fs fs
f
−B B
fs fs
Xsd( f )
D =3
Aliasing Aliasing Aliasing Aliasing Aliasing Aliasing Aliasing Aliasing
f
−B B
fsd fsd fsd fsd fsd /
fsd = fs D fsd fsd
Low-pass filter
f
−B B
fs fs
Xsd( f )
D =3
f
−B B
fsd fsd fsd fsd fsd /
fsd = fs D fsd fsd
As illustrated in Figure B.13, there is aliasing if Fsd = Fs /D is less than the Nyquist
rate; in other words, the sampling rate can be reduced by a factor of D without aliasing
if the original sampling rate Fs is at least D times the Nyquist rate F Nyquist = 2B, i.e.,
Fs D (2B). If this condition is not satisfied, a low pass filter can be applied to the
original signal to reduce its bandwidth to B so that Fs D (2B ) before downsampling.
where the superscript “u” stands for “upsampling” . The case of upsampling for U = 2
is illustrated in Figure B.11, in which an extra sampling point is added between two
adjacent original sampling points and 0 is assigned at the new sampling points.
☞ In the digital signal processing literature, the upsampling operation is also called
“interpolation” . However, only 0 is filled at the new sampling points, and no
attempt is made to “interpolate” the missing data values.
The DTFT of the upsampled signal Xnu , −∞ < n < +∞, is
+∞
∞
Xs ( F ) = X u(t) e−i 2πF t dt = X u(n us ) e−i 2πF · ns us
u u
−∞ n=−∞
∞
∞
X(r s ) δ(n−r U) e−i 2πF · ns us
u
=
n=−∞ r=−∞
∞
1
∞
= X(r s ) e−i 2πF · r U (s/U) (s /U ) = · s Xr e−i 2πF · rs,
r=−∞ U r=−∞
which yields
Xsu( F ) = U1 Xs ( F ). (B.5.8)
T 50000
N= = = 107 . (B.6.2)
s 0.005
The sampling frequency Fs = 1/s = 200 Hz, and the frequency resolution is given by
F = 1/T = 0.00002 Hz. X(t) is generated using Matlab function wgn(m,n,p) with
m = 107 , n = 1, and p = 0 (implying PdBW = 0 or P W = 1 W). Because there are too
many points in the time-history, only a small portion is plotted in Figure B.14(a).
X( F ) of X(t) is computed based on DFT. Matlab function fft(x), where X(t) is
input as x, is employed to obtain DFT XK of X(t) first. X( F K ) is then determined by
multiplying XK by time interval s = 0.005 s using equation (B.2.42).
Because F = 1/T, the longer the duration T of the time-history, the higher the
resolution (or the smaller the value of F ) of the corresponding FAS.Although GWN is
a stationary random process with constant X( F ), X(t) is only one realization of GW;
hence, the corresponding FAS will be quite scattered. For duration T = 50000 s, FAS is
able to distinguish very small frequency difference of F = 0.00002 Hz, far smaller than
frequency resolution range (e.g., F = 0.02 Hz) of engineering interest. Figure B.14(b)
shows a small portion of FAS, which seemingly does not provide much information.
Therefore, in engineering applications, it is necessary to smooth the FAS X( F ) by
reducing its frequency resolution. Taking F = 0.02 Hz as an example, the length of the
smoothed FAS is N = 2×100/0.02 = 10000. The smoothed FAS X are evaluated
at frequencies F n = n F , − 5000 n 5000. X is determined as
2 1 2
999
X ( F ) = X( F n +0.00002K) , (B.6.3)
n 1000 K=0
Figure B.14(e) presents the FAS X( F ) with frequency resolution of F = 0.05 Hz,
with number of frequency points N = 2×100/0.05 = 4000. It is seen that, with the
reduction of frequency resolution (increase of F ), a smoother FAS is obtained. Figure
B.14(f) shows the one-sided FAS.
The energy of X(t) is given by
On the other hand, the total energy of X(t) is given by the Parseval’s theorem in the
discrete form
N−1
N−1
e= X 2 s =
n
X( F )2 F = 50000 N · m. (B.6.5)
n=0 K=0
Because X(t) is a GWN process, X( F ) is a constant over the entire frequency range.
Equation (B.6.5) becomes
e
e = N X( F )2 F =⇒ X( F ) = . (B.6.6)
N F
50000 50000 50000
= = = = 15.81. (B.6.7)
10 ×0.00002
7 10000×0.02 4000×0.05
Digital Filters
Figure B.14(g) shows the filtered-GWN by passing GWN through a low-pass filter with
cut-off frequency Fc = 30 Hz. The digital filtering is performed using Matlab function
fftfilt(b,x), where the GWN X(t) is input as x. b=fir1(n,Wn,ftype,window) is
used to determine window-based filter coefficients, in which n is the order of the filter;
n = 2M in equation (B.4.3). Wn is the normalized cut-off frequency defined as the
592 appendix b. digital signal processing
4
(a)
2
X(t)
0
−2
t (s)
−4
0 1 2 3 4 5 6 7 8 9 10
50
(b) Frequency resolution = 0.00002 Hz, two-sided FAS (partial)
40
|X( f )|
30
20
10
0
0 0.002 0.004 0.006 0.008 0.01 0.012 0.014 0.016 0.018 0.02
f (Hz)
20
(c)
|X( f )|
15
Frequency resolution = 0.02 Hz, two-sided FAS
f (Hz)
10
−100 −80 −60 −40 −20 0 20 40 60 80 100
25
|X( f )|
20
(e)
|X( f )|
15
Frequency resolution = 0.05 Hz, two-sided FAS
f (Hz)
10
−100 −80 −60 −40 −20 0 20 40 60 80 100
25
|X( f )|
20
Frequency resolution = 0.05 Hz, one-sided FAS
(f) f (Hz)
15
0 10 20 30 40 50 60 70 80 90 100
3
(g)
2
1
X(t)
0
−1
−2 Filtered-GWN, f c =30 Hz, Δ s =0.005 s, M =25 t (s)
−3
0 1 2 3 4 5 6 7 8 9 10
20
(h)
15 M =25 Frequency resolution = 0.02 Hz
|X( f )|
30
one-sided FAS
10 Filtered-GWN, f c =30 Hz M =15
(i) f (Hz)
0
0 10 20 30 40 50 60 70 80 90 100
3
(b)
2
1
X(t)
0
−1
−2 Filtered-GWN, f c = 30 Hz, Δ s =0.005 s, M = 25, upsample U =5, Δus =0.001 s
t (s)
−3
5 5.5 6 6.5 7 7.5 8 8.5 9 9.5 10
30
Filtered-GWN, f c =30 Hz, M =25 Frequency resolution = 0.02 Hz
|X( f )|
20
one-sided spectrum
10 (c) Filtered-GWN, f c = 30 Hz, M = 25, upsample U =5
f (Hz)
0
0 10 20 30 40 50 60 70 80 90 100
Figure B.15 Upsampling of filtered-GWN.
3
(a)
2
1
X(t)
0
−1
−2
Filtered-GWN, f c =50 Hz, Δ s =0.005 s, M =25 t (s)
−3
0 1 2 3 4 5 6 7 8 9 10
3
(b)
2
1
X(t)
0
−1
−2
Filtered-GWN, f c =50 Hz, Δ s =0.005 s, M =25, downsample D =2, Δds =0.01 s t (s)
−3
0 1 2 3 4 5 6 7 8 9 10
30
Aliasing
|X( f )|
20
Frequency resolution = 0.02 Hz Filtered-GWN, f c =50 Hz, M =25, downsample D = 2
10 one-sided FAS Filtered-GWN, f c =50 Hz, M =25
(c) f (Hz)
0
0 10 20 30 40 50 60 70 80 90 100
3
(d)
2
1
X(t)
0
−1
−2
Filtered-GWN, f c =40 Hz, Δ s =0.005 s, M =25 t (s)
−3
0 1 2 3 4 5 6 7 8 9 10
3
(e)
2
1
X(t)
0
−1
−2
Filtered-GWN, f c =40 Hz, Δ s =0.005 s, M =25, downsample D =2, Δds = 0.01 s t (s)
−3
0 1 2 3 4 5 6 7 8 9 10
30
Filtered-GWN, f c =40 Hz, M =25, downsample D =2
|X( f )|
20
Frequency resolution = 0.02 Hz
10
(f)
one-sided FAS Filtered-GWN, f c =40 Hz, M =25 f (Hz)
0
0 10 20 30 40 50 60 70 80 90 100
Figure B.16 Downsampling of filtered-GWN.
594 appendix b. digital signal processing
ratio of cut-off frequency Fc to Nyquist frequency. ftype indicates the type of filter,
such as ’low’ for low-pass and ’high’ for high-pass filters. window includes a num-
ber of commonly used window functions. b=fir1(50,0.3,’low’,blackman(51))
is used in Figure B.14(g) to remove frequency contents with F > Fc ( Fc = 30 Hz and
F Nyquist = 100 Hz giving Wn = 30/100 = 0.3). The Blackman window function is applied
with M = 25.
The two-sided and one-sided FAS of the filtered process are shown in Figure B.14(h)
and (i), respectively. The filtered process is a “band-limited GWN” with a constant
FAS for F < Fc . However, as discussed in Section B.4, due to the use of a window
function in digital filter, there is a significant transition region between 20 and 40 Hz.
The transition region can be reduced by increasing the order of the filter, i.e., the value
of M; as seen in Figure B.14(h) and (i), the transition region with M = 25 is smaller
than that with M = 15.
Upsampling
Based on the filtered-GWN with Fc = 30 Hz and M = 25, as shown in Figure B.14(g),
Figure B.15(a) and (b) shows portions of the time-history from upsampling with U = 5
(giving the new sampling interval us = 0.001 s). The resulting FAS of the time-history
from upsampling is shown in Figure B.15(c) along with the FAS of the filtered-GWN. It
is clearly seen that the two FAS satisfy equation (B.5.8) with U = 5.
Downsampling
A portion of the time-history of filtered-GWN with Fc = 50 Hz and M = 25 is shown
in Figure B.16(a), and the corresponding downsampled time-history with D = 2 (lead-
ing to ds = 0.01 s) is shown in Figure B.16(b). For the downsampled time-history,
Fsd = 1/ds = 100 Hz and the maximum frequency range is F max Fsd /2 = 50 Hz. The
resulting FAS from downsampling is shown in Figure B.15(c) along with the FAS of the
original filtered-GWN. Even though F max = Fc = 50 Hz = Fsd /2 satisfying the Nyquist-
Shannon sampling requirement, there is still aliasing error near 50 Hz due to the
existence of transit region from digital filtering.
Similar results are shown in Figure B.16(d) to (f) for filtered-GWN with Fc = 40 Hz
and M = 25. In this case, F max = 40 Hz and Fsd = 100 Hz, resulting in Fs = 2.5× F max .
From Figure B.16(f), it is seen that, for F 50 Hz, FAS of the downsampled signal is
the same as the original signal and there is no aliasing error.