Anda di halaman 1dari 5

Digital Signal Processing Lab

Lab 10: Radar-based Human Gait Recognition


January 29, 2019 SIGNAL

Due Date of Report: February 5, 2019


PROCESSING
GROUP

1. Introduction

In Lab 3, we computed the discrete-time Fourier transform (DFT) to obtain frequency-domain represen-
tations of both periodic and finite-length signals. However, in practice, signals are infinitely long and not
necessarily periodic. In these cases, we would have to wait inordinately long to acquire all the samples,
and a subsequent DFT calculation would not only be computationally expensive, but also many temporal
variations of the signal would be lost. For these reasons, we introduce the Short-time Fourier Transform
(STFT), which can be considered a time-dependent discrete Fourier transform.
In this lab, you will learn how to calculate and interpret the STFT. Using different signals, such as
a frequency modulated (FM) signal and radar data, you will investigate the STFT’s properties and its
benefits over DFT calculation.

1.1 Problem Formulation

3 3

2 2

1 1
x 1 (n)

x 2 (n)

0 0

-1 -1

-2 -2

-3 -3
0 50 100 150 200 250 0 50 100 150 200 250
n n

150 150

100 100
|X 1 (j )|

|X 2 (j )|

50 50

0 0
0 0.5 1 1.5 2 2.5 3 0 0.5 1 1.5 2 2.5 3

Figure 1: Two different signals x 1 (n) 6= x 2 (n) with the same spectrum, i.e., |X 1 ( jΩ)| = |X 2 ( jΩ)|

In order to demonstrate the use of the STFT as opposed to calculating the spectrum, consider the
following signals [3]

x 1 (n) = sin(9πn/16 − (n − 128)2 π/1280 − π/2) + sin(πn/18)


+ 1.2 sin(15πn/16 − (n − 128)2 π/1024 − π/2) exp(−((n − 180)/40)2 ) (1)
+ 1.2 sin(4πn/16 − (n − 128) π/4096 − π/2) exp(−((n − 64)/40) ), 2 2

1
and x 2 (n) = x 1 (255 − n) for n = 0, 1, . . . 255. Figure 1 shows the time domain representations and
corresponding spectra of the signals. Clearly, both signals produce the same amplitude of the Fourier
transform. That means, the shift in time between the two time signals is lost because the Fourier trans-
form does not provide a time distribution of the spectral components.

S 1 (n, ) S 2 (n, )

3 3

2.5 2.5

2 2

1.5 1.5

1 1

0.5 0.5

0 0
50 100 150 200 250 50 100 150 200 250
n n

Figure 2: Spectrograms corresponding to the signals x 1 and x 2 depicted in Figure 1.

1.2 The Short-time Fourier Transform and the Spectrogram

The short-time Fourier transform (STFT) of a discrete-time signal x(n) is calculated as [2, 1]

L−1
X
STFT(n, k) = w(m)x(n + m)e− j(2πk/K)m , (2)
m=0

where L is the length of the smoothing window w(·), and k is the discrete frequency index, where
k = 0, . . . , K − 1 with L, K ∈ N. The STFT is a joint-variable representation of frequency vs. time and its
interpretation is as follows. The window w(m) is nonzero only for m = 0, . . . , L , where L is assumed to
be much smaller than the total length of the sequence x(n). Hence, the product w(m)x(n + m) is also
nonzero only in this interval. In this way, a finite-length segment from the sequence x(n) is selected.
By adjusting the shift n, the desired segment of x(n) is moved into the window. The right-hand side of
Equation (2) is the K -point DFT of the finite length sequence w(m)x(n + m) so that Equation (2) can be
evaluated for each choice of n via the FFT.

The spectrogram depicts how the signal power varies with time, where its amplitude is typically given
in dB. It is found as
S(n, k) = 10 · log |STFT(n, k)|2 .

(3)

Here, the k dimension represents frequency and ω̂k = 2πk/N is the kth analysis frequency, and n repre-
sents time.

In order to depict the spectrogram graphically, we have to choose a three-dimensional representation


mode. For example, the MATLAB function imagesc will display the spectrogram as a two-dimensional

2
image, where the power is indicated by the color (Hint: use the command colobar to display the range
of values for the third dimension, i.e, the power in dB). Of course, you can also use the built-in MATLAB
function spectrogram to calculate and display the spectrogram of a signal. An example of calculating
and displaying the spectrogram of a quadratic chirp sampled at 1 kHz using MATLAB is given as follows:

t = 0:0.001:2; % signal duration is 2 seconds


x = chirp(t,100,1,200, 'quadratic '); % generate a quadratic chrip with inital
% frequency 100 Hz and 200 Hz at 1 second
spectrogram(x,blackman(128),60,128,1e3) % calculate and display spectrogram using
% a blackman window of length 128, an
% overlap of 60 samples, and K = 128
ax = gca; ax.YDir = 'reverse '; % reverse y-axis

1.3 Resolution of the Spectrogram

According to Equation (2), the finite number of discrete frequency points K and the finite window length
L are to be chosen. In general, K can be larger than L utilizing zero-padding before calculation of the FFT,
thus increasing the granularity of the resulting spectrum. The key parameters that control the resolution
of the spectrogram are the length and the shape of the applied window w. There is an inverse relationship
between window length and the ability to resolve two adjacent frequencies in the spectrum. Specifically,
a continuous-time rectangular window of duration T seconds has a Fourier transform mainlobe width of
∆ω = 4π/T . Given a window of length L = T /Ts samples, the mainlobe width is

∆ω = fs [rad/samples], (4)
L
where fs = 1/Ts is the sampling frequency. Another example for a window function is the Hamming
window. Its Fourier transform mainlobe width is twice as wide as that of the rectangular window.
Thus, a window length twice as long is needed to achieve the same frequency resolution as that of the
rectangular window.
However, when increasing the window length L , short-duration time events or rapid transitions merge
with other parts of the signal. Hence, using a longer window duration in the spectrogram calculation
decreases the time-resolution. This is known as the uncertainty principle of Fourier spectrum analysis:
time resolution and frequency resolution cannot be improved simultaneously in the spectrogram.

2. Preparation

1. You are given a speech signal that has been sampled at 8 kHz and then analyzed with MATLAB
using the spectrogram function and the following parameters:
• Hamming window with length L = 100,
• FFT length of K = 256,
• and overlap of 80 points.
Determine the resolution of the resulting spectrogram:
(a) Determine the frequency resolution in Hz.
(b) Determine the time resolution in s.

2. Determine the mathematical formula for an FM signal that has the instantaneous frequency given
in Equation (7).

3
3. Problems

Problem 3.1 Frequency Modulated Signal Analysis

In this problem you will examine sinusoidal signals whose frequency is changing over time, i.e.,
frequency-modulated (FM) sinusoids. For this, consider a sinusoidal signal of the form

x(t) = Acos(2π f c t + φ) = Acos(ψ(t)) (5)

where ψ(t) is the phase. The time derivative of the phase ψ(t) gives the so-called instantaneous fre-
quency
d
ωi (t) = ψ(t) [rad/s]. (6)
dt

Define a frequency modulated (FM) signal whose instantaneous frequency is sinusoidal, i.e.,

ωi (t) = 2π f c + 2πα cos(2πβ t + γ), (7)

where f c is the center frequency, and the parameters α, β and γ control the sinusoidal frequency modu-
lation.

• Write a MATLAB function to create sinusoidal FM signals of the form defined in Equation (5) with
an instantaneous frequency given in Equation (7) (see preparation Question 2.), i.e.,
genFMsignal(alpha, beta, gamma, fc, fs, tStart, tStop),
where fs is the sampling frequency, and tStart and tStop are the start and end time of the
signal in seconds, respectively.

• Create a sinusoidal FM signal with f c = 100 Hz, α = 50, β = 1.5, and γ = π/3. The signal duration
should be 3.04 seconds, starting at t = 0. Use a sampling rate of 1 kHz. The signal amplitude
should be one. Plot the FM signal.

• Write a function calc_STFT to implement Equation (2). The input arguments are a signal x , a
window w, and a time step Ts . The function should return the STFT as a matrix S. Assume that x
and w are column vectors and Ts is a nonnegative integer which describes how many time samples
are skipped between successive DFT calculations.

• Create the spectrogram of your FM signal, and use it to verify that you have the correct instanta-
neous frequency predicted by Equation (7). Note that the window length should be short enough
to track the changing instantaneous frequency. Comment on your results.

Problem 3.2 Spectrograms of Human Walk

In this problem, you will use the data which you recorded during the last session in the SPG lab. For this
proceed as follows:

• Use the provided function read_radar_data() to read your radar data. For further information
on the function, type help read_radar_data into the MATLAB command window.

4
• Calculate the STFT of your radar data using your function calc_STFT from the previous problem.
Apply a Hamming window of L = 256 samples, and a time step of Ts = 10 samples. Evaluate the
DFT at K = 2048 frequency bins.

• Calculate and display the spectrogram. Label your axis appropriately. Use the function
get_noise_thr() to obtain a limit for the power in dB. Hint: use this threshold and caxis
to get an optimal representation of the spectrogram.

• Extract the relevant part of the spectrogram, i.e., Doppler frequencies between 0 and 500 Hz for
toward, and 0 and -500 Hz for away from radar movements, respectively. Restrict the measurement
to a time interval that is free from motion artifacts, i.e., cut off the beginning and the end of the
measurements.

• Elaborate on your observations. Can you discern the different walking styles that you recorded in
the last lab session?

Now, let us have closer look at one of your radar measurements. Can we extract some features that
are relevant for human gait recognition? Pick one of your measurements, e.g. normal walk data, and
answer the following questions:

• How fast is a foot swinging when taking a step? Explain.

• What is the average walking speed? Name one possible way to extract this information from the
spectrogram.

• What is the stride rate in the observed walk, i.e., the number of steps per second?

References

[1] J.H. McClellan, R.W. Schafer, and M.A. Yoder. Signal Processing First. Number Bd. 1 in Signal
Processing First. Pearson/Prentice Hall, 2003.

[2] Alan V. Oppenheim, Ronald W. Schafer, and John R. Buck. Discrete-time Signal Processing. Prentice-
Hall, Inc., Upper Saddle River, NJ, USA, 1999.

[3] Ljubisa Stanković, Miloš Daković, and Thayannathan Thayaparan. Time-frequency signal analysis
with applications. Artech House, 2013.

Anda mungkin juga menyukai