Report#
Submit one set of handwritten answers per group at 12:30.
These questions on paper for the last hour (11:30-12:30h) of this session assess your understanding of the subject, your mathematical reasoning and insight, as well as interpretation of results, not your ability to recall specific Python syntax. There are five questions.
Computers, phones, online resources and AI tools are not permitted. You may use only handwritten notes prepared earlier in the session. Show the formulas and reasoning that support your answers; numerical or graphical answers without an explanation will not receive full credit.
Short re-cap of section 3.4 on sampling from the MUDE textbook#
The Fourier transform of continuous-time signal \(x(t)\) is \(X(f)\) as a function of frequency \(f\). The Fourier transform of the (impulse train) sampled signal \(x_s(t)\) is
so, the spectrum of the sampled signal is the spectrum of the original signal, but repeated with “period” \(f_s\) (in the frequency domain); copies of spectrum are called aliases.
|
|---|
Spectrum of an assumed original signal \(x(t)\) (left) and that of its sampled equivalent (right) |
Full re-cap of section 3.5 on Discrete Fourier Transform from the MUDE textbook#
Discrete time Fourier Transform (DTFT)#
We discretize Fourier transform of \(x_s(t)\)
by replacing the integral by summation over time:
with \(x_n=x(n\Delta t)\) and where complex exponential is also evaluated at times \(t=n\Delta t\), and \(n\in\mathbb{Z}\).
This is still a continuous function of frequency \(f\) (\(f\in\mathbb{R}\)), periodic with period \(f_s\), exactly as we got with impulse train sampling, and known as Discrete Time Fourier Transform (DTFT).
In the example below we use \(x(t)=\textrm{sinc}^{2}(t)\) as an arbitrary, but very convenient signal, to demonstrate the impact of sampling on the Fourier transform of a signal.

This figure shows (continuous-time) signal \(x(t)\) at left, and the corresponding Fourier transform \(X(f)\) at right (in this case, very convenient, the Fourier transform is a real-valued function, not complex). Next, signal \(x(t)\) is sampled, and the resulting \(x_s(t)\) is shown below by the stems. The same range for the horizontal axis is used as before, but it has been stretched for better visibility. The sampling frequency is \(f_s = 3\) Hz.

Finally the Fourier transform \(X_s(f)\) of sampled signal \(x_s(t)\) is shown below. One can clearly see that the Fourier transform \(X_s(f)\) consists of many copies of the original Fourier transform \(X(f)\); these copies occur every integer multiple of the sampling frequency \(f_s\) (here \(f_s=3\) Hz). Acknowledging this finding, one would, in practice, need to consider only one period of this particular function (the rest consists of repetitions anyway); so for instance consider just the frequency range \([0,f_s)\) or \([-\frac{f_s}{2},\frac{f_s}{2})\). We will meet these particular choices again below, with the Discrete Fourier Transform (DFT).

Discrete Fourier Transform (DFT)#
We want to analyze spectrum \(X_s(f)\) of sampled signal \(x_s(t)\) using a computer, i.e. by Digital Signal Processing (DSP). Two issues remain, however:
we cannot measure the signal forever, so we cannot have \(n\to\infty\)
once sampled in time domain, still continuous function (of frequency) does not lend itself to DSP - algorithm requires discrete data points as input, and delivers discrete data points as output
Action item 1 - we cannot measure signal forever
Sampled signal \(x_s(t)\) is a sequence \(x_n\) with \(n=\{-\infty,...,\infty\}\), so values \(x_n=x(n\Delta t)\) at discrete times \(t=n\Delta t\) (with \(n\in\mathbb{Z}\)).
We consider it only for time duration \(T=N\Delta t\), resulting in just N samples; effectively this means applying a window \(\Pi\left(\frac{t}{T}\right)\); in practice we set the signal to zero outside window, hence: \(x_{sw}(t)=\Pi\left(\frac{t}{T}\right)x_s(t)\)
This means \(x_n\) with \(n=0,...,N-1\) has finite length
Action item 2 - continuous function does not lend itself to DSP
‘Sample’ the frequency spectrum: we will evaluate it only at discrete frequencies.
As we only use piece of \(T=N\Delta t\) of the signal in time domain, the smallest resulting frequency is frequency step-size \(\Delta f\) and referred to as frequency (or spectral) resolution
showing that the interval \([0,f_s)\) in the frequency domain is divided into \(N\) equal steps \(\Delta f\). Remember that \(X_s(f)\) is periodic with period \(f_s=\frac{1}{\Delta t}\), hence considering just the interval \([0,f_s)\) is sufficient, as the function \(X_s(f)\) is repeating. Hence, the spectrum will be computed at frequencies
This results in the so-called Discrete Fourier Transform (DFT). DFT turns \(N\) samples of signal \(x(t)\) into \(N\) samples of spectrum \(X_{sw}(f)\):
with both \(n\) and \(k\in\{0,1,...,N-1\}\).
Going back to our action items:
Action item 1:
Sampled, windowed signal \(x_{sw}(t)\) equals sequence \(x_n\) with \(n=0,1,...,N-1\). Then, \(X_{sw}(f)=\int_{-\infty}^{\infty}x_{sw}(t)e^{-j2\pi ft}dt\), which we discretize with step size \(\Delta t\) into:
Action item 2:
Finally, we ‘sample’ the frequency spectrum, turning \(X_{sw}(f)\) into \(X_{sws}(f)\) by considering only \(f=k\Delta f\) with \(\Delta f=\frac{1}{T}=\frac{1}{N\Delta t}=\frac{f_s}{N}\) and \(k=0,1,...,N-1\):
Hence sequence \(X_k\) equals \(X_{sws}(f)\) at \(f=k\Delta f\) for \(k=0,1,...,N-1\):
This is the discrete Fourier transform (DFT), typically implemented in software packages as fft (in Python, we will use numpy.fft.fft), though implemented without factor \(\Delta t\).
Inverse Fourier Transform (IDFT)#
The Inverse Fourier Transform reads \(x(t)=\int_{-\infty}^{\infty}X(f)e^{j2\pi ft}df\). Applying it to the sequence \(X_k\) and discretizing the integral yields:
Considering sampling in the time domain as \(t=n\Delta t\):
Summary#
with both \(k\) and \(n\in\{0,1,...,N-1\}\)
With \(X_k\), we consider function \(X(k\Delta f)\) by restoring frequency dimension, frequency step-size, \(\Delta f=\frac{1}{T}=\frac{1}{N\Delta t}=\frac{f_s}{N}\)
With \(x_n\), we consider function \(x(n\Delta t)\) by restoring time dimension, with time step \(\Delta t=\frac{1}{f_s}\)
In many textbooks we find the DFT as:
with both \(k\) and \(n\in\{0,1,...,N-1\}\)
Hence, without factors \(\Delta t\) and \(\frac{1}{\Delta t}\). This is also how DFT is implemented in programming languages like Matlab and Python; the user has to restore time and frequency dimension!
Re-cap of the Python notebook#
In Task 2 you used continuous-time signal \(x(t) = A \sin (2 \pi f_c t + \phi)\) with amplitude \(A=1\) V, carrier frequency \(f_c=1\) Hz, and phase offset \(\phi=5^o\) (converted into radians). This is a plain (undamped) sinusoid. This signal was observed/measured for a duration of \(T_{meas}=5.0\) s and sampled at \(f_s=100\) Hz, giving exactly \(N=500\) discrete-time samples \(x_n\), with \(n=0,\ldots,N-1\). The sampled signal is shown below, the samples are connected by line-segments.
|
|---|
Sampled signal \(x_s(t)\), i.e. samples \(x_0, x_1, \ldots, x_{N-1}\), shown as a function of time \(t\), with \(t=n \Delta t\) in seconds. |
The Python np.fft.fft turns these \(N\) samples of the signal, into \(N\) ‘samples’ of the signal’s Fourier transform \(X_k\) with \(k=0,\ldots,N-1\). The magnitude \(|X_k|\), using np.abs, is shown in the graphs below. The result of Python’s np.fft.fft has actually been divided by \(N\), as to align the amplitude with the continuous-time Fourier transform, but this is not relevant here.
|
|---|
Magnitude of Discrete Fourier Transform (DFT) result \(\lvert X_k \rvert \), at left in log-log-scale, at right in linear scale |
Question 1#
The horizontal axes of the above plots (from Task 2 in the Python notebook) range from \([0,f_s)\) (indeed, in the log-log plot the value \(f=0\) has actually been omitted, as this is problematic in terms of a logarithm; the horizontal axis starts from \(0.1\) Hz instead).
Explain why the Fourier transform output in Python covers just \([0,f_s)\) rather than the entire frequency-axis from \(f=-\infty\) to \(\infty\).
Solution — Question 1#
As a consequence of sampling, converting a continuous-time signal into a discrete-time signal, the spectrum becomes periodic, with period \(f_s\), see section 3.4 of the MUDE-textbook. Hence, covering, with the output in the frequency domain, just a single period, e.g. \([0,f_s)\), is practically sufficient. All the rest is repetition, and hence not necessary to provide explicitly.
Question 2#
Instead of using Python, you’ll now do a Discrete Fourier Transform (DFT) on a simple signal yourself.
A zero initial phase \(\phi=0\), unit-amplitude, cosine \(x(t)=\cos(2 \pi f_c t)\) with carrier frequency \(f_c=1\) Hz, has been measured for \(T_{meas}=2\) s, with a sampling frequency of \(f_s=10\) Hz. As a result, there are \(N=20\) discrete-time samples. These samples are input to the Python np.fft.fft. The result is divided by \(N\) (though not really relevant here), and the modulus is taken, resulting in \(|X_k|\) with \(k=0,\ldots,N-1\).
Create a plot of the magnitude spectrum \(|X_k|\) as a function of index \(k\) on the horizontal axis, in linear scale. So, we (you) do plt.plot(np.abs(Xk)/N). How does the result look like? Include your (hand-drawn) sketch of the resulting plot in your report. Please plot (and mark) all N output values, also the zero ones.
Solution — Question 2#
A unit-amplitude plain cosine with frequency \(f_c\) has as it Fourier transform (in the limit) \(X(f)=\frac{1}{2} \delta(f+f_c) + \frac{1}{2} \delta(f-f_c)\), hence two Dirac delta functions. That is how far the theory with a continuous-time signal gets. The signal got sampled, in this case with a sufficiently high sampling frequency, such that aliasing does not occur. The spectrum \(X(f)\) now gets copied to every integer multiple of \(f_s\). And, in the output Python, by default, considers the frequency range \([0,f_s)\) corresponding to the range of \(k=0,\ldots,N-1\). The frequency step-size is \(\Delta f = \frac{1}{T_{meas}}\), which in this case equals \(\Delta f = \frac{1}{2}\) Hz. A peak at \(f_c=1\) Hz corresponds to a peak at \(k=2\), and a peak at \(f_s-f_c=9\) Hz corresponds to a peak at \(k=18\) (this is the \(-1\) Hz of the first copy of the spectrum, positioned at one time \(f_s\)). The other values are (very close to) zero. The amplitude of the peaks in the graph equals \(0.5\), as with the Fourier transform of the continuous-time signal, though this is not of importance here. The locations of the peaks are!
|
|---|
DFT result $ |
Question 3#
Does aliasing occurs while sampling the signal in this case, of Question 2? Why, or why not?
Solution - Question 3#
The Nyquist sampling theorem provides the answer (and this is easily concluded as well from the spectrum of the sampled signal, with \(f_h\) and \(f_s\), shown at the start of this report). The highest frequency in the signal \(x(t)\) to be sampled is \(f_h\), and the sampling frequency is \(f_s\). Then there is no overlap of the copies in the spectrum as long as \(f_s \geq 2 f_h\) (or \(f_s > 2 f_h\)).
Question 4#
Now we repeat the above Question 2, but instead of \(f_s=10\) Hz, we now use \(f_s=5\) Hz (the values of all other parameters stays the same, except for \(N\) which now is \(N=10\) discrete time samples).
Provide the output of the DFT, i.e. a graph of \(|X_k|\) as a function of index \(k\) (just as with Question 2). Again plot (and mark) all N output values, also the zero ones.
Solution - Question 4#
The plain cosine signal got sampled, in this case with a sufficiently high sampling frequency, such that aliasing does not occur. The spectrum \(X(f)\) gets copied to every integer multiple of \(f_s\). And, in the output Python, by default, considers the frequency range \([0,f_s)\) corresponding to the range of \(k=0,\ldots,N-1\), hence this changes with respect to Question 2: now we have \(f_s=5\), and consequently \(N=10\). The frequency step-size is \(\Delta f = \frac{1}{T_{meas}}\), which in this case equals \(\Delta f = \frac{1}{2}\) Hz (identical to \(\Delta f\) in Question 2). A peak at \(f_c=1\) Hz corresponds to a peak at \(k=2\), and a peak at \(f_s-f_c=4\) Hz corresponds to a peak at \(k=8\). The others values are (very close to) zero. The amplitude of the peaks is not of importance here.
|
|---|
DFT result $ |
Question 5#
Finally we extend the case of the Question 4. The sampling frequency stays at \(f_s=5\) Hz and we still measure the signal for \(T=2\) s. The signal however now consists of TWO plain cosine signals (both unit amplitude and zero initial phase): \(x(t)=\cos(2 \pi f_1 t) + \cos(2 \pi f_2 t)\) with \(f_1=1\) Hz as in Question 4, and \(f_2=3\) Hz.
Provide the output of the DFT, i.e. a graph of \(|X_k|\) as a function of index \(k\) (just as with Question 4). Again plot (and mark) all N output values, also the zero ones.
Solution - Question 5#
The spectrum of the first cosine will not change, with a peak at \(k=2\) (\(1\) Hz) and a peak at \(k=8\) (\(4\) Hz). The second plain cosine signal with \(f_2=3\) Hz, once sampled with \(f_s=5\) Hz, will suffer from aliasing. The spectrum \(X(f)\) gets copied to every integer multiple of \(f_s\), and here we need to consider specifically the copy at one time \(f_s\). The original (continuous-time) spectrum of the second cosine has a Dirac delta peak at \(f=-3\) Hz and one at \(f=3\) Hz. The copy at one time \(f_s\) will have these peaks at \(f=-3+5=2\) Hz and \(f=3+5=8\) Hz. Adding these in, and knowing that the output in Python, by default, considers the frequency range \([0,f_s)\) corresponding to the range of \(k=0,\ldots,N-1\), we get a peak at \(k=4\) (representing the \(2\) Hz alias), next to a peak at \(k=6\) (for the \(3\) Hz, but being interpreted as alias \(-2\) Hz; with a sampling frequency of \(f_s\) one would look, in a symmetric double-sided spectrum, only for frequencies \(-\frac{f_s}{2},\frac{f_s}{2}\). The frequency step-size is unchanged, \(\Delta f = \frac{1}{2}\) Hz. The others values are (very close to) zero. The amplitude of the peaks is not of importance here.
|
|---|
DFT result $ |
How did things go? (Optional)#
After the session, your group may share feedback with us (i.e. the teaching team) about the notebook and the written questions. You can also use this space to let us know if you ran into challenges while working on this GA, and if you have any feedback to report.
By Christian Tiberius, Delft University of Technology. CC BY 4.0, more info on the Credits page of Workbook.





