Signals and Systems - Mock Exam 2
Questa pagina non ha ancora la versione ripasso: qui sotto c'è il testo completo.
In questa pagina 7
Mock exam built on the model of the written exams of the equivalent Italian-language course (Signals and Systems, Information Engineering, UniPD): it is a simulation, not an official paper. Time: 3 hours (the most recent exam of the course; the two exams of early 2025 gave 2 hours and 30 minutes). No documents allowed. For every question justify the answer and show all the calculations you consider necessary; when asked to sketch a signal, find its support and sketch its shape, even roughly. Structure: 3 exercises of 7 points, 2 theory questions of 4 points, 1 Matlab question of 3 points (total 32 points). To pass you need at least 10 points in the exercises and at least 5 between theory and Matlab.
Conventions. ; for and otherwise; is the unit triangle supported on ; is the unit step; is the angular frequency in rad/s, the frequency in Hz, and (in Exercise 3, ).
Exercise 1 (points 7)
Exercise 1: Continuous-time convolution. Let so that for and elsewhere. The signal is the impulse response of an LTI system , and is its response to the input .
- Sketch and , giving their supports. Without computing any integral, find the support of . Is causal? Is it BIBO stable?
- Compute for every , piece by piece, and sketch it.
- Check the result of point 2: compute in a second way, without using the pieces, and find the maximum of and where it is attained.
- Write the derivative (Dirac impulses allowed), show that and verify this against the pieces found in point 2.
Show the result
- , , . is causal and BIBO stable ().
- . Maximum , attained for every (plateau).
- , hence : it equals on , on , on , in agreement with point 2.
Show the full solution
Point 1. The signal is a rectangle of height and width centred at : it is for . The signal is a decaying exponential from the value down to , then it drops to (a jump at ).
Grafico interattivo: x(t) = rect((t−1)/2) (continuo, vale 1 tra 0 e 2) e h(t) = e^{−2t} tra 0 e 1 (tratteggiato: parte da 1 e scende fino a e^{−2} ≈ 0,135, poi salta a 0)
Support of . By the support rule of Continuous-Time Convolutioncontinuous-time impulse response and the convolution integral for LTI systems, conditions for its existence in L1 and L2, its properties and the step response of the first-order system h(t) = e^{-gamma t} 1(t).Continuous-Time Convolution →: if lives in and in then for and for . Here the sum of the left ends is and the sum of the right ends is , so outside . (Intuition: the output starts as soon as the flipped touches and ends when it has left it completely.)
Causality. for , so the output at time depends only on the input at times : is causal (Properties of Convolutional LTI SystemsA convolutional LTI system is completely described by its impulse response h (or by its step response), and BIBO stability, staticity, causality and series or parallel interconnection are all read directly from h.Properties of Convolutional LTI Systems →).
Stability. An LTI system is BIBO stable iff (Stability of LTI Systems - BIBO and Internal StabilityCharacterization of BIBO (external) stability and of internal stability of LTI convolutional systems through the mode functions: stability zones in the complex plane, asymptotic, marginal and unstable behaviour of the natural response, and an example of an externally stable but internally unstable system with a zero-pole cancellation.Stability of LTI Systems - BIBO and Internal Stability →): Any bounded and with finite support is in , so stability was clear in advance. Typical mistake: judging stability from the shape of instead of .
Point 2. Use the definition Here is the constant for , and when , i.e. when . The integrand is therefore on the intersection of and , and elsewhere. Sliding the window to the right gives the cases:
- : the window is entirely to the left of , empty intersection, ;
- : the intersection is (the window has entered only on the right);
- : the window is fully inside, the intersection is ;
- : the intersection is (the window sticks out on the right);
- : empty intersection, .
An antiderivative of with respect to is (the derivative in of the exponent gives ). Hence:
- : ;
- : , a constant: the whole of sits inside the region where ;
- : .
Continuity check (the convolution of two bounded signals with finite support is continuous): at the first piece is ; at the first piece gives , equal to the second; at the third piece gives , equal to the second; at the third piece gives . All the junctions match.
Grafico interattivo: y(t) = (h*x)(t): sale da 0 con pendenza 1 fino a (1−e^{−2})/2 ≈ 0,432 in t = 1, resta costante fino a t = 2, poi scende a 0 in t = 3; vale 0 fuori da [0, 3]
Typical mistakes: using the wrong limits in the middle region (writing for all gives , which keeps rising towards instead of staying flat at ); forgetting that the third piece has a different integrand limit (, not ); leaving the answer as a single formula without the pieces.
Point 3. Area. Exchange the order of integration (valid because , see Continuous-Time Convolutioncontinuous-time impulse response and the convolution integral for LTI systems, conditions for its existence in L1 and L2, its properties and the step response of the first-order system h(t) = e^{-gamma t} 1(t).Continuous-Time Convolution →): This is also in the frequency domain (Properties of the Fourier TransformProperties of the Fourier transform with proofs: time shift, modulation, rescaling, convolution theorem, temporal product, time-frequency duality, symmetries, derivative, integral and multiplication by t, followed by worked exercises on a ramp-times-rectangle and on the squared sinc.Properties of the Fourier Transform →). Integrating the pieces directly gives the same number: and the sum is . The two methods agree.
Maximum. On the first piece has derivative (increasing); on is constant; on the derivative is (decreasing). So the maximum is , attained on the whole interval . It coincides with : when the whole lies where , the output is just the area of .
Point 4. The derivative of the rectangle: jumps from to at (contributing ) and from to at (contributing ), and it is constant in between (Continuous-Time Unit Step and Dirac Impulsethe continuous unit step and the Dirac impulse defined as a generalized function through the sifting property, three constructions as limits (rectangular, Gaussian, sinc), the convergence theorem for continuous signals and the properties of the impulse.Continuous-Time Unit Step and Dirac Impulse →, Derivatives of the Dirac Impulsethe unit doublet and higher-order derivatives of the Dirac impulse defined through integration by parts, the product formula between a derivative of the impulse and a signal, and worked exercises on derivatives of discontinuous signals.Derivatives of the Dirac Impulse →): Convolution commutes with differentiation, , and the Dirac impulse is the neutral element, : Compare with the pieces: on only is non-zero, and ✓; on both and vanish, and the plateau has zero derivative ✓; on only survives, and ✓. As is continuous, has no Dirac impulses, consistent with the absence of impulses in (the jumps of at and of at are jumps of , not impulses).
Another check. Since , with the step response of : for and for . Subtracting the copy delayed by gives exactly the three pieces above.
Exercise 2 (points 7)
Exercise 2: Fourier transform. Consider the signal
- Compute the Fourier transform of using the properties of the transform, and sketch . Say whether is real and/or even, whether is real and/or even, and whether is band-limited; if so, find and the band of .
- Compute the energy of using Parseval's relation, and check the value in the time domain.
- Let . Compute , its modulus and phase, the integral and the energy .
- Find the signal whose Fourier transform is .
Show the result
- : equal to for , elsewhere. is real and even, is real and even. is band-limited with rad/s ( Hz); band (a band-pass signal).
- .
- ; for (and elsewhere); for and for (inside the band). . .
- .
Show the full solution
Point 1. From Fourier Transform of Common SignalsFourier transform of periodic signals through the transform of the complex exponential as a Dirac impulse, and a catalogue of computed transforms: cosine, sine, constant, causal exponential, two-sided exponential, rectangle and sinc, sign function, unit step and 1/t.Fourier Transform of Common Signals →, (the rectangle has width in ). Write the cosine with Euler's formula, , and use the modulation property (Properties of the Fourier TransformProperties of the Fourier transform with proofs: time shift, modulation, rescaling, convolution theorem, temporal product, time-frequency duality, symmetries, derivative, integral and multiplication by t, followed by worked exercises on a ramp-times-rectangle and on the squared sinc.Properties of the Fourier Transform →): , which shifts the spectrum. With and : The first rectangle is when , i.e. ; the second is for . They do not overlap (there is a gap between them), so is a pair of blocks of height . (At the four edges the transform takes the midpoint value .)
Grafico interattivo: X(jω): due blocchi di altezza 1/2 sulle bande 2π < |ω| < 4π (reale e pari); nulla per |ω| > 4π e nella zona centrale |ω| < 2π
Symmetries (Properties of the Fourier TransformProperties of the Fourier transform with proofs: time shift, modulation, rescaling, convolution theorem, temporal product, time-frequency duality, symmetries, derivative, integral and multiplication by t, followed by worked exercises on a ramp-times-rectangle and on the squared sinc.Properties of the Fourier Transform →): is the product of two real even signals, so it is real and even; consequently is real and even, as the figure shows. Band: for , so is band-limited, with rad/s, i.e. Hz; the band is on the positive axis (the signal has no low-frequency content, it is band-pass). Note that , so the pair above holds in the sense (Fourier TransformThe Fourier transform extends the Fourier series to aperiodic signals: intuitive derivation from a periodic square wave with growing period, definition of the transform and of its inverse, convergence results in L1 and L2 and the Plancherel and Parseval relation.Fourier Transform →); the properties used are valid anyway.
Typical mistakes: centring the rectangles at instead of ; forgetting the factor coming from (the amplitude would be ); writing the width of the rectangle as instead of .
Point 2. Parseval's relation in (Fourier TransformThe Fourier transform extends the Fourier series to aperiodic signals: intuitive derivation from a periodic square wave with growing period, definition of the transform and of its inverse, convergence results in L1 and L2 and the Plancherel and Parseval relation.Fourier Transform →, Energy and Power of SignalsEnergy and average power of continuous- and discrete-time signals over finite and infinite horizons, finite-energy signals, mutual energy as a scalar product, and the Lebesgue spaces L2 and l2 of finite-energy signals.Energy and Power of Signals →): . The integrand is on two intervals of length : Check in time. , so The first integral is the energy of the sinc: by Parseval, , which gives . The second integral is the transform of evaluated at the frequency Hz (the integral of is for even real ); since is zero for , it is . Total: ✓. Typical mistake: forgetting the factor and obtaining .
Point 3. A delay gives and the derivative gives a factor (Properties of the Fourier TransformProperties of the Fourier transform with proofs: time shift, modulation, rescaling, convolution theorem, temporal product, time-frequency duality, symmetries, derivative, integral and multiplication by t, followed by worked exercises on a ramp-times-rectangle and on the squared sinc.Properties of the Fourier Transform →). The two operations commute, so Modulus: in the band (it grows linearly from at to at , and is even). Phase: for , , so (the term is the delay); for , , so . The phase is odd, as it must be for a real signal (Hermitian symmetry).
Integral. , because ( is not in the band). It agrees with .
Energy. The delay changes only the phase, the derivative multiplies the modulus by : Typical mistakes: writing (the derivative is not an all-pass operation); forgetting the phase term of the delay; forgetting the factor from the two symmetric bands.
Point 4. Use duality (Properties of the Fourier TransformProperties of the Fourier transform with proofs: time shift, modulation, rescaling, convolution theorem, temporal product, time-frequency duality, symmetries, derivative, integral and multiplication by t, followed by worked exercises on a ramp-times-rectangle and on the squared sinc.Properties of the Fourier Transform →): . We want and is even, so and two rectangles of height and width , centred in . Check: ✓. Typical mistake: forgetting the factor that the duality introduces.
Exercise 3 (points 7)
Exercise 3: Sampling. Let ( in seconds). The sampling is ideal (impulse train): , with .
- Compute the Fourier transform of and sketch it. Is band-limited? Give and the values of for which can be perfectly reconstructed from its samples.
- Let Hz. Write and sketch the spectrum of the sampled signal; explain why there is no aliasing. Design the ideal low-pass reconstruction filter (gain and range of the cut-off ) and, for Hz, write its impulse response .
- Now let Hz, with no anti-aliasing filter, and reconstruct with an ideal low-pass filter of gain and cut-off . Compute for and the spectrum of the reconstructed signal for . Is ? Compute the energy of the error .
- The signal is sampled with Hz and reconstructed with the ideal low-pass filter of gain and cut-off Hz. Find the reconstructed signal .
Show the result
- : a triangle of height supported on . Band-limited, Hz ( rad/s). Perfect reconstruction for Hz.
- : triangles of height centred in and supported on , no overlap. Filter: gain , Hz; for Hz , and .
- (constant) for . for , for , otherwise. . Error energy .
- (alias at Hz, with the phase sign changed).
Show the full solution
Point 1. The pair comes from and the product theorem: (Properties of the Fourier TransformProperties of the Fourier transform with proofs: time shift, modulation, rescaling, convolution theorem, temporal product, time-frequency duality, symmetries, derivative, integral and multiplication by t, followed by worked exercises on a ramp-times-rectangle and on the squared sinc.Properties of the Fourier Transform →, Exercise 2 of that note). Rescaling by (): Check: (area of a triangle of base and height ) ✓.
Grafico interattivo: X(f) = 2Λ(f/3): triangolo di altezza 2 e base 6 Hz (|f| < 3)
vanishes for Hz, so is band-limited with Hz. The sampling theorem (Sampling and the Sampling TheoremSampling multiplies a continuous-time signal by a pulse train, which replicates its spectrum every omega_s; if the signal is band-limited with maximum angular frequency omega_M and omega_s exceeds 2 omega_M, an ideal low-pass filter recovers it exactly (Shannon theorem and sinc interpolation formula).Sampling and the Sampling Theorem →) requires Hz, i.e. s (strict inequality). Typical mistake: using the null-to-null width as if it were (the Nyquist rate is Hz, not Hz).
Point 2. Ideal sampling replicates the spectrum, (Sampling and the Sampling TheoremSampling multiplies a continuous-time signal by a pulse train, which replicates its spectrum every omega_s; if the signal is band-limited with maximum angular frequency omega_M and omega_s exceeds 2 omega_M, an ideal low-pass filter recovers it exactly (Shannon theorem and sinc interpolation formula).Sampling and the Sampling Theorem →; the same result in is ). With :
Grafico interattivo: X_p(f) per f_s = 8 Hz: triangoli di altezza 16 centrati in 8n, con base da 8n−3 a 8n+3; tra un triangolo e il successivo resta uno spazio libero di 2 Hz (da 3 a 5): nessuna sovrapposizione
The central triangle occupies and the first replica : there is a free gap , so the replicas do not overlap (the condition is ) and there is no aliasing. To isolate the central replica and bring it back to the height of , use an ideal low-pass filter The gain compensates the factor of the replicas. The best choice is the middle of the range, Hz. Its impulse response is the inverse transform of the rectangle (Frequency-Selective FiltersA convolutional LTI system filters by multiplying the input spectrum by H(j omega); ideal low-pass and high-pass filters, first-order RC implementations, distortion-free transmission (Heaviside conditions), why the ideal low-pass filter is not realizable, and the practical design parameters.Frequency-Selective Filters →): , that is, for , Then and : it is the Shannon interpolation . Typical mistakes: forgetting the replica height (writing instead of ); choosing Hz, which lets the first replica through.
Point 3. With Hz the replicas are . The central triangle (up to ) and the replica centred in (from ) overlap in : aliasing, since . In only these two triangles are non-zero: a constant (the two descending and ascending edges add up exactly). By evenness the same holds in .
Grafico interattivo: X_p(f) per f_s = 5 Hz: i triangoli (altezza 10, base 6) centrati in 5n si sovrappongono; nelle zone 2 ≤ |f| ≤ 3 la somma vale esattamente 10/3, il picco in f = 0 resta 10
The filter of gain and cut-off Hz keeps and divides by : there. For the replicas do not reach (they start at ), so ; for , . Hence : in the spectrum is wrong (for instance at Hz, while ) and the part is lost.
Error energy. is: for ; for , (from up to ); for , (from back to ); the same on the negative side. By Plancherel, (no in ): Typical mistakes: forgetting the gain (spectrum five times too large); thinking that aliasing only affects the band where the replicas overlap (the filter also cuts , which is lost for good); adding the energies of and instead of using the difference.
Point 4. Spectrum of the sinusoid: , with Hz Hz: the sampling theorem is violated (Aliasing and Anti-Aliasing FiltersAliasing is the overlap of spectral replicas that occurs when the band-limited or Nyquist assumptions of the sampling theorem fail; an anti-aliasing low-pass filter with cut-off omega_s/2 applied before sampling removes it at the price of losing the high frequencies; two worked exercises.Aliasing and Anti-Aliasing Filters →). The replicas have lines at ; those falling in are:
- from with : a line at with weight ;
- from with : a line at with weight .
The lines at (and at ) are outside the filter. After the gain : Check on the samples: , which are exactly the samples of at . The alias frequency is Hz and the sign of the phase is reversed (mirror image around ). Typical mistake: answering (the frequency is found but the phase is not).
Theory 1 (points 4)
Parseval's relation for the Fourier transform.
- State Parseval's relation (Plancherel theorem) for the Fourier transform, in its energy form and in its general form for two signals, with the hypotheses.
- Prove the general form for two signals whose transforms are in and which are continuous, and deduce the energy form.
- Give the physical meaning of the relation and show how it is used to compute the energy of a signal in a frequency band.
Show the result
- Statement. For with transforms :
- Key steps. Write with the inverse transform, exchange the two integrals (Fubini), recognise in the inner integral.
- is the energy spectral density: the energy in a band is (both positive and negative frequencies); in the factor disappears.
Show the full solution
1. Statement. (See Fourier TransformThe Fourier transform extends the Fourier series to aperiodic signals: intuitive derivation from a periodic square wave with growing period, definition of the transform and of its inverse, convergence results in L1 and L2 and the Plancherel and Parseval relation.Fourier Transform → and Energy and Power of SignalsEnergy and average power of continuous- and discrete-time signals over finite and infinite horizons, finite-energy signals, mutual energy as a scalar product, and the Lebesgue spaces L2 and l2 of finite-energy signals.Energy and Power of Signals →.) If , then and In the frequency () the relation is , with no constant. The extension to every is obtained by approximating with signals of (the transform of an signal is defined as the limit of the transforms of the approximations, see Fourier TransformThe Fourier transform extends the Fourier series to aperiodic signals: intuitive derivation from a periodic square wave with growing period, definition of the transform and of its inverse, convergence results in L1 and L2 and the Plancherel and Parseval relation.Fourier Transform →); the general form for two signals is the scalar product version, (Hilbert SpacesA Hilbert space is a complete scalar-product space; C^N, l^2 and L^2(S) are Hilbert spaces, and the scalar product in l^2 and L^2 is what engineers call mutual energy.Hilbert Spaces →).
2. Proof. Let , continuous, with . Then the inverse transform holds pointwise (Fourier TransformThe Fourier transform extends the Fourier series to aperiodic signals: intuitive derivation from a periodic square wave with growing period, definition of the transform and of its inverse, convergence results in L1 and L2 and the Plancherel and Parseval relation.Fourier Transform →): Substitute in the left-hand side: The double integral of is (because and ), so Fubini's theorem allows exchanging the order: The inner integral is, by definition, . Energy form: take , so that and . (If does not satisfy the extra hypotheses on , one applies the relation to the approximating signals and passes to the limit.)
3. Meaning and use. is the total energy, and the relation says that it can be computed in either domain: is the energy spectral density (energy per unit of angular frequency, up to the factor ). The energy contained in a band (positive and negative frequencies together) is . Example with the signal of Exercise 2: on , so , with no integral in time. The scalar-product form gives orthogonality in the time domain from disjoint spectra (two signals with non-overlapping supports of and are orthogonal: ), and, for example, that the translated sincs are mutually orthogonal (Sampling and the Sampling TheoremSampling multiplies a continuous-time signal by a pulse train, which replicates its spectrum every omega_s; if the signal is band-limited with maximum angular frequency omega_M and omega_s exceeds 2 omega_M, an ideal low-pass filter recovers it exactly (Shannon theorem and sinc interpolation formula).Sampling and the Sampling Theorem →). Typical mistakes: forgetting when working in (the energy of the sinc would come out as instead of ); integrating only over without doubling; applying the relation to signals that are not in (periodic signals have infinite energy: for them one uses the power and the Fourier series, Continuous-Time Fourier SeriesA periodic continuous-time signal is written as a combination of harmonics e^{jn w0 t} whose coefficients a_n are projections of the signal onto each harmonic; coefficients have symmetries that mirror those of the signal.Continuous-Time Fourier Series →).
Theory 2 (points 4)
The convolution theorem for the Fourier transform.
- State the convolution theorem for the Fourier transform of continuous-time signals, with its hypotheses.
- Prove it.
- Use it to show that a convolutional LTI system with impulse response acts as a multiplication in the frequency domain, and compute the response to .
Show the result
- If then .
- Proof by exchanging the order of the two integrals (Fubini, allowed because ) and the change of variable .
- , with the frequency response; the response to is (it is an eigenfunction).
Show the full solution
1. Statement. Let with transforms and . Then and The hypothesis guarantees that the convolution exists, that (Continuous-Time Convolutioncontinuous-time impulse response and the convolution integral for LTI systems, conditions for its existence in L1 and L2, its properties and the step response of the first-order system h(t) = e^{-gamma t} 1(t).Continuous-Time Convolution →) and that the integrals below can be exchanged.
2. Proof. By definition, The double integral of equals , so by Fubini's theorem the order can be exchanged. Writing : In the inner integral put , (for fixed ): it becomes , which does not depend on and comes out: (See Properties of the Fourier TransformProperties of the Fourier transform with proofs: time shift, modulation, rescaling, convolution theorem, temporal product, time-frequency duality, symmetries, derivative, integral and multiplication by t, followed by worked exercises on a ramp-times-rectangle and on the squared sinc.Properties of the Fourier Transform →. The dual statement is , used for the sampling theorem.)
3. Consequences for LTI systems. For a convolutional LTI system with (BIBO stable, Stability of LTI Systems - BIBO and Internal StabilityCharacterization of BIBO (external) stability and of internal stability of LTI convolutional systems through the mode functions: stability zones in the complex plane, asymptotic, marginal and unstable behaviour of the natural response, and an example of an externally stable but internally unstable system with a zero-pole cancellation.Stability of LTI Systems - BIBO and Internal Stability →) the theorem gives Filtering becomes a multiplication: and , and the cascade of two systems has frequency response (and impulse response ) (Frequency Response of LTI SystemsApplying the Fourier transform to LTI convolutional systems described by ODEs: the frequency response H(jw) is the transform of the impulse response, equals Y/U, is a ratio of polynomials in jw, and can be inverted by partial fractions to get h(t), with a warning about causality when the system is not asymptotically stable.Frequency Response of LTI Systems →). For the input , directly from the convolution integral, so complex exponentials are eigenfunctions with eigenvalue (Eigenfunctions and Frequency Response of LTI Systemsfor a BIBO stable convolutional LTI system the complex exponential e^{j w t} is an eigenfunction and the frequency response H(jw), the Fourier transform of the impulse response, is its eigenvalue; for real h the response to a cosine is a scaled and phase-shifted cosine.Eigenfunctions and Frequency Response of LTI Systems →). Example: for the system of Exercise 1, . Typical mistakes: applying the theorem to signals not in without comment (for sinusoids and constants one uses generalised transforms with Dirac impulses); confusing it with the product theorem, which carries the factor .
Matlab 1 (points 3)
Matlab question: aliasing of a sampled sinusoid. Write a Matlab script that:
- generates the sinusoid with Hz on the interval , s, on a fine time grid (step s), to represent the continuous-time signal;
- samples it with Hz and then with Hz, and for each case draws in one figure the continuous signal together with the samples (over the first second only);
- for each computes the FFT of the samples and draws the modulus of the spectrum in a second figure, with a correct frequency axis in Hz, so that the position of the peaks can be read;
- compares, in the title and on screen, the frequency of the peak with the one predicted by the theory.
Show the result
- Hz: samples, frequency step Hz; peaks of height at Hz (no aliasing).
- Hz: samples, same step Hz; peaks of height at Hz: the apparent frequency is Hz (aliasing, ).
- Frequency axis:
f = (-N/2 : N/2-1)*fs/Nafterfftshift, from to .
Show the full solution
Recall that for the samples the DFT is a sampled version of the spectrum of the signal, with frequency step (Discrete Fourier TransformHeuristic derivation of the discrete Fourier transform for N-periodic discrete-time signals: complex exponentials with period N, the finite basis of N modes obtained from the difference equation x(k)-x(k-N)=0, orthogonality, the coefficient formula and the definition of the DFT with its periodicity and matrix form.Discrete Fourier Transform →, Properties of the Discrete Fourier Transformthe DFT with its inverse, translation and modulation properties, the correspondence between cyclic convolution and product, Parseval's relation, and the example of a periodic rectangular pulse train whose DFT is a Dirichlet kernel.Properties of the Discrete Fourier Transform →). fft returns the unnormalised sum with the frequencies in the order (the last half corresponds to the negative frequencies): fftshift puts the zero frequency in the centre, and dividing by makes the height of the lines equal to the amplitude of the complex exponentials ( for a unit cosine). Here is an integer number of periods and is an integer, so the lines fall exactly on FFT bins (no leakage, no need for zero-padding).
%% Aliasing of a sampled sinusoid, seen with the FFT
clear all; close all; clc;
%% 1. Parameters and "continuous" signal
f0 = 7; % frequency of the sinusoid [Hz]
T = 4; % observation time [s]
fs_list = [20 10]; % sampling frequencies [Hz]: 20 > 2*f0, 10 < 2*f0
tc = 0 : 1e-3 : T; % very fine time grid: only used to draw x(t)
xc = cos(2*pi*f0*tc);
for i = 1:numel(fs_list)
fs = fs_list(i); % sampling frequency
Ts = 1/fs; % sampling period
N = round(T*fs); % number of samples in [0, T)
k = 0 : N-1; % sample indices
t = k*Ts; % sampling instants
xs = cos(2*pi*f0*t); % samples x(k*Ts)
%% 2. Time domain: signal and samples
figure(2*i-1);
plot(tc, xc, 'LineWidth', 1); hold on;
stem(t, xs, 'filled');
xlim([0 1]); % first second only
xlabel('t [s]'); ylabel('x(t)'); grid on;
title(sprintf('f_0 = %g Hz sampled at f_s = %g Hz', f0, fs));
legend('x(t)', 'samples');
%% 3. Frequency domain: FFT with a correct axis
X = fftshift(fft(xs)) / N; % zero frequency in the centre, normalised
f = (-N/2 : N/2-1) * fs / N; % axis in Hz, from -fs/2 to fs/2 - fs/N (N even)
f_alias = abs(f0 - fs*round(f0/fs)); % predicted apparent frequency
figure(2*i);
stem(f, abs(X), 'filled'); grid on;
xlabel('f [Hz]'); ylabel('|X|');
title(sprintf('|FFT|, f_s = %g Hz: predicted peaks at +-%g Hz', fs, f_alias));
%% 4. Peak found vs peak predicted
fpos = f(f >= 0);
[~, idx] = max(abs(X(f >= 0)));
fprintf('fs = %g Hz: peak at %g Hz, predicted %g Hz\n', fs, fpos(idx), f_alias);
endExpected output: for Hz the samples follow the cosine well (about three samples per period) and the spectrum has two lines of height at Hz, inside the range ; for Hz the samples (less than per period) lie on the slower cosine of Hz, which in the first figure seems to pass through all of them, and the spectrum has the two lines at Hz: the line that "should" be at Hz has been folded back by , because . The theoretical value is printed by fprintf next to the measured one.
Typical mistakes: using fft without fftshift and then plotting against 0:N-1 (axis in bins, not in Hz, and negative frequencies shown on the right); building the axis with linspace(-fs/2, fs/2, N), which has points but the wrong step (, and the endpoint is not a bin); forgetting that the sampling frequency, not , sets the width of the axis; drawing the "continuous" signal with the same coarse grid as the samples (the aliasing would not be seen, only a polygonal line).
Self-assessment grid
| Exercise | Points | What must be there for full marks | Typical mistakes |
|---|---|---|---|
| Exercise 1 | 7 | Supports of , , and sketches (1 point); causality and stability judged on (0.5); correct integration window in the three regions and the three formulas for , with a continuity check (3); area as product of areas and maximum on the plateau (1.5); derivative with Dirac impulses and verified (1) | Wrong limits of integration in the middle region; forgetting the plateau; judging stability from ; no continuity check; wrong sign or position of the Dirac impulses |
| Exercise 2 | 7 | by modulation with the correct centres , height , symmetries and band (2); with the and the time-domain check (1.5); with modulus, phase, and (2.5); dual signal with the factor (1) | Centres at instead of ; missing factor ; (no ); derivative treated as not changing the modulus; missing delay phase; factor in the duality |
| Exercise 3 | 7 | and Hz (1); with height , gap between replicas, filter with gain and , (2); overlap value , , and (2.5); alias at Hz and phase (1.5) | Replica height without the factor ; Hz; forgetting the gain ; Nyquist rate taken as Hz; alias with the wrong phase sign |
| Theory 1 | 4 | Statement with hypotheses, energy form and two-signal form (1); proof with the inverse transform, Fubini and the inner integral recognised as (2); meaning as energy spectral density and use for the energy in a band (1) | Missing factor in ; no justification of the exchange of integrals; forgetting the complex conjugate in the two-signal form; applying it to periodic signals (infinite energy) |
| Theory 2 | 4 | Statement with the hypothesis (1); proof with Fubini and the change of variable (2); consequence and eigenfunction property (1) | Missing justification of the exchange of integrals; wrong change of variable; applying it to constants and sinusoids without generalised transforms; confusing with the product theorem () |
| Matlab 1 | 3 | Fine grid and samples correct, time plot with stem (1); fft with fftshift, division by and axis in Hz from to (1.5); alias frequency predicted and compared with the peak (0.5) |
Axis in bins; fft without fftshift; wrong frequency step; continuous signal drawn on the coarse grid |
Total: 32 points. Pass: at least 10 points in the three exercises and at least 5 in the two theory questions and the Matlab question together.