Assignment2 22 23
Assignment2 22 23
Problem 1
Calculate the N −point DFT for the following discrete-time signals with n = 0, 1, 2, ....
1. x[n] = (2n )cos(0.5πn) ; N = 3;
2. x[n] = tan π3 n (u[n] − u[n − 2]); N = 4.
Problem 2
Consider a discrete-time signal x̃[n] with period N . We know that mN is also a period of x̃[n] for any positive
integer m. Let X̃m [k] denotes the DFS coefficients of x̃[n] considered as a periodic sequence with period mN .
Clearly, when m = 1, X̃1 [k] is the typical DFS coefficients of x̃[n] that we are familiar with.
1. Express X̃3 [k] in terms of X̃1 [k].
2. Plot figure of the following discrete-time periodic signal
∞
X ∞
X
x̃[n] = δ[n − 2k] + 2δ[n − 2k − 1].
k=−∞ k=−∞
3. Calculate X̃3 [k] and X̃1 [k] of the above signal x̃[n], and verify the result that you obtained in the first
question.
Problem 3
Suppose we have an aperiodic signal:
n n
5 4
x[n] = u[n] − u[n − 1].
6 5
We can construct a periodic signal based on x[n]:
∞
X
x̃[n] = x[n + lN ].
l=−∞
Let N = 2,
1. plot figure of x[n] and calculate its DTFT X(ejω );
2. plot figure of x̃[n] and calculate its DFS X̃[k];
3. explain the relation between X̃[k] and X(ejω ).
Problem 4
Consider the following two finite-duration signals:
x1 [n] = 2ejω0 n , n = 0, 1, 2
x2 [n] = 3n , n = 0, 1, 2
1. Calculate the 3-point DFT, X1 [k], of x1 [n].
2. Calculate the 3-point DFT, X2 [k], of x2 [n].
3. Calculate y[n] = x1 [n]○x
3 2 [n] by 3-point circular convolution.
4. Calculate y[n] in the previous question by multiplying X1 [k] and X2 [k], and then performing an IDFT.
Compare the results of the two ways computing y[n].
1
Problem 5 (Optional)
Suppose we have an aperiodic signal: n
1
x[n] = u[n],
3
and its DTFT is denoted as X(ejω ). We also have a sequence y[n] which equals zero when n < 0 and n ≥ 10.
The 10-point DFT of y[n] is denoted as Y [k]. Suppose the following holds:
Y [k] = X(ej2πk/10 ),
Problem 6
Use MATLAB, Python, or other programming languages that you prefer to handle this problem.
1. In the area of remote sensing, researchers detect materials by collecting waves reflected by these materials.
Different materials will reflect wave differently. Fig.1 shows some reference spectrums of the waves reflected
by some different materials.
• Load the waves of the first material ”material1 real.txt” and ”material1 imag.txt” for the signal’s
real part and imaginary part. Load the second material in the same way.
• Plot the magnitude of the two waves.
• Use FFT to calculate the spectrum of the two waves and plot the spectrum’s magnitude.
• Comparing the obtained spectrum with Fig.1, can you identify what the two materials are?
0.035
Vegetation
Soil
0.03 Water
Olivine
0.025
Magnitude
0.02
0.015
0.01
0.005
0
0 5 10 15 20 25 30 35 40 45 50
Spectrum
2. • Load the data files ”sig1 16000.txt”, ”sig2 48000.txt”, and ”sig3 16000.txt”. Plot the three signals.
The number in the file name indicates the sampling frequency. For example, ”sig1 16000.txt” means
the sampling frequency of this signal is 16000Hz.
• Calculate the FFT of these signals and plot the spectrum’s magnitude. Make sure that your horizontal
axis is the frequency.
• Roughly indicate the frequencies or frequency regions that the energy of the signal is concentrated
around.
• The three signals are audios sampled from the real world: a piece of fricative sound, a piece of violin
sound, and a vowel sound. Can you give a guess which signal corresponds to which sound?
2
Hint: Concerning loading the data, let’s take ”sig1 16000.txt” as an example. For MATLAB, you may load the
data by:
x = load(”sig1 16000.txt”)
The signal is stored in the variable x. For Python, you may try
import numpy as np
x = np.loadtxt(”sig1 16000.txt”)
The signal is also stored in the variable x. You may also use reshape() to adjust your data dimension, like make
it be a column vector from a row vector.
Problem 7 (Optional)
The Linear Frequency Modulation (LFM) pulse is widely used in areas like remote sensing and communication.
Mathematically, it has the form (simplified):
where k is a parameter to control the shape of the LFM signal; the duration of the pulse is T and the start
point of the signal is assumed to be t = −T /2. We can see that the frequency changes linearly with respect to
the time and that is also where the name LMF comes from. In practical systems, the LFM signal is handled in
discrete form. Hence, let’s denote the sampled version as:
where fs is the sampling frequency. Let k = 2 × 1010 , T = 5 × 10−5 , and fs = 1 × 107 . Use MATLAB, Python,
or other programming languages that you prefer to solve the following questions.
1. Plot the real and imaginary parts of x[n].
2. Use FFT to compute the discrete spectrum, X[k], of x[n] and plot the magnitude.
3. Let X̄[k] be the conjugate of X[k]. Obtain a new spectrum by Y [k] = X̄[k]X[k] and plot its magnitude.
4. Calculate the IFFT of Y [k], i.e., y[n], and plot the magnitude of y[n]. From the result, can you give
some explanation on why LMF pulse is suitable for radars to localize targets, i.e., measure the distance
between the radar and the target? (Hint: radar senses targets by sending a pulse and receiving the echo.
A high-energy pulse can sense far targets; a narrow pulse can distinguish close targets, i.e., high sensing
resolution. Yet, placing high energy directly on a narrow pulse isn’t easy.)