MATLAB Simulation Series 1 Exercise
MATLAB Simulation Series 1 Exercise
Convolution
In mathematics (in particular, functional analysis), convolution is a mathematical operation on two functions
that produces a third function (f ∗ g). The term convolution refers to both the resulting function and to the
process of computing it. It is defined as the integral of the product of the two functions after one is reflected
about the y-axis and shifted. The integral is evaluated for all values of shift, producing the convolution function.
The choice of which function is reflected and shifted before the integral does not change the integral result
Graphically, it expresses how the 'shape' of one function is modified by the other.
+∞
(𝑓 ∗ 𝑔) = ∫ 𝑓 (𝜏)𝑔(𝑡 − 𝜏)𝑑𝜏
−∞
Question 1) Consider a linear time-invariant (LTI) system with the impulse response h(t) = (e-2t – e-3t)u(t),
where u(t) is the unit step function. The input to the system is given as x(t) = cos(2t)u(t) + sin(5t)u(t). Find the
output y(t) of the system by performing the convolution y(t) = x(t) * h(t). plot the input x(t), the impulse
response h(t), and the output y(t).
Fourier series
A Fourier series is an expansion of a periodic function into a sum of trigonometric functions. The Fourier series
is an example of a trigonometric series. By expressing a function as a sum of sines and cosines, many problems
involving the function become easier to analyze because trigonometric functions are well understood.
𝑁
𝑛 𝑛
𝑠𝑁 = 𝑎0 + ∑(𝑎𝑛 cos (2𝜋 𝑥) + 𝑏𝑛 sin (2𝜋 𝑥))
𝑝 𝑝
𝑛=1
1 𝑝 2 𝑝 𝑛 2 𝑝 𝑛
𝑎0 = ∫ 𝑠(𝑥) 𝑑𝑥 𝑎𝑛 = ∫ 𝑠(𝑥) cos (2𝜋 𝑥) 𝑑𝑥 𝑏𝑛 = ∫ 𝑠(𝑥)sin(2𝜋 𝑥) 𝑑𝑥
𝑝 0 𝑝 0 𝑝 𝑝 0 𝑝
Part A) Calculate the Fourier series coefficients a0, an and bn for this signal.
Part B) Reconstruct the signal x(t) using the first N=5 harmonic.
Part C) Plot both the original signal and the reconstructed signal over the interval t € [0.8].
Part D) Compute the Mean Squared Error (MSE) between the original and reconstructed signals.
Part E) What effect does it have on the reconstructed signal if we increase the number of harmonics.
Description
• The first question counts for 25% of the score, the second question counts for 75% of the score, and
each section of the second question counts for 15% of the score.
• In addition to having code, your exercise should also have a work report. The work report includes an
explanation and logic for each part of your code.
• The file sent to the LMS environment must be in zip format, which contains MATLAB codes and work
reports. The file name must also be in Form HW#_last name_student number.
• In case of cheating, a score of zero will be given for the exercise or question.
• After the exercise deadline, the exercise answer along with the explanation file will be posted for you in
the LMS environment.
• If you encounter any problems or have any questions about the exercise, you can send a message to the
Telegram ID @aahmadizad14.
Good luck
Amirmohammad Ahamdizad