EEE 5502 Code 4: 1 Problem
EEE 5502 Code 4: 1 Problem
EEE 5502 Code 4: 1 Problem
Michael Olvera
October 2019
1 Problem
How many hours did you spend on this homework? 10 hours
2 Problem
The DFT / DTFT of an entire piece of music shows all of those frequencies. As an example, consider the signal
2πn2
x[n] = cos( ) (1)
10000
This is known as a linear frequency-modulated “chirp” signal whose instantaneous frequency w[n] changes linearly
with time. Chirp signals are commonly used in RADAR processing to extract time- varying time-shifts (distance
from a target) and frequency/doppler-shifts (velocity of a target). In this context, the instantaneous frequency
w[n] is defined by
x[n] = cos((ω/2)n) (2)
More specifically, the instantaneous frequency w[n] is the time-derivative of the expression inside the cosine, also
known as the instantaneous phase.
1. Determine the instantaneous frequency of x[n] for n = 0, n = 1000, and n = 2500. Express the frequencies
as a function of pi (e.g., pi/100).
4πn
ω[n] =
10000
ω[n = 0] = 0
(3)
2π
ω[n = 1000] =
5
ω[n = 2500] = π
2. Plot x[n] with a length of 2501. Label the horizontal axis “Samples” and vertical axis “Amplitude.” Also,
use the fft function to compute the DFT of x[n] (i.e., X[k]). Use the abs function in MATLAB to plot the
magnitude response of X[k]. Label your horizontal axis “Normalized frequency [rad / s]” with values 2pik/N.
Label your vertical axis “Magnitude.” After plotting, apply the command axis([0 2*pi 0 max(abs(X))]) to
see the figure from 0 to 2pi in frequency and 0 to the maximum value in magnitude.
Figure 1: x[n] Plot
1
Figure 2: abs(x[n]) Plot
Figure 3: abs(x[n]) for 0 to 2pi in frequency and 0 to the maximum value in magnitude. Plot
2
Since the DFT / DTFT is poor for analyzing such signals, we may instead analyze signal segments. Yet,
this can affect the precision of our results. To demonstrate this, consider the cosine
3. Compute and sketch the magnitude and phase of the DTFT of y[n].
∞
X
DT F T [y[n]] = |Y (ω)| = δ(ω − (π/2) − 2πk) + δ(ω + (π/2) − 2πk)
k=∞ (6)
6 Y (ω) = 0
4. Compute and sketch the magnitude and phase of the DTFT Z(w) of a segment of the cosine signal, defined
by z[n] = y[n]w[n] for N = 10.
5. (EEE 5502 Only) Show that the “bandwidth” of the W(w) (defined as the length between the two locations
nearest to w= 0 where W(w) = 0) is inversely proportional to the width of the rectangular window N.
Recall the DTFT of a rectangular function: The first zero of the sinc function should give you half the
bandwidth
sin(ω(N + 1/2))
DT F T [rect(x)] =
sin(ω/2)
sin(ω(N + 1/2)) = 0
(7)
ω(N + 1/2) = 2π
2π
ω=
N + 1/2
6. (EEE 5502 Only) This result implies that the we cannot simultaneously analyze the fre- quency content
of a signal with perfect temporal resolution and perfect frequency resolution. We often refer to this as a
time-frequency uncertainty principle. Explain how the previous result shows this.
This is true because the more we try to narrow time or analyze the temporal signal (i.e thin rect function),
the sinc function will just get wider and therefore we get a greater spread of frequencies (which explains
why omega gets bigger with small N). It can also be said the other way around.
3
3 Problem
1. Code the following short-time Fourier Transform process for your chirp x[n]:
2. Plot the short-time Fourier transform values for 8 different values of W . Specifically, consider W equal to
10, 20, 40, 80, 160, 320, 640, and 1280.
3. Your plots should illustrate the time-frequency uncertainty principle. For which value of W do you think
best illustrates the chirp signal?
4 Problem
1. Compute the short-time Fourier transform of your Rudenko music x. Use the MATLAB code to plot the
short-time Fourier transform magnitude values for W = 10, 000. Use the axis command from Question 2
to focus only on the lower frequencies from 0 to pi/20. Note that the code above is plotting time in seconds
since we know the sampling rate.