Exp 1
Exp 1
Learning Objective: The aim of this lab session is to get familiar with the Matlab function fft() and
use it to analyze spectrum of some signals.
Experiments: In this lab we will determine the frequency spectrum of a one dimensional signals.
You may use the fft() function of Matlab for this purpose. This lab session consists of the following
problems:
1. Consider a signal that consists of sum of two sinusoidal signals
s(t) = a1 cos(2 π f1 t + θ1) + a2 cos(2 π f2 t + θ2)
(a) Assume θ1 = θ2= 0. Represent and plot this signal in Matlab. Notice that this is a
continuous signal, hence you need to sample this signal appropriately.
(b) Apply Fourier transform to this signal and plot magnitude and phase spectrum. Interpret
your result. Hint: What is the values of the magnitude spectrum for frequencies other
than f1 and f2? Is the phase value reliable at these points?
(c) What is the value of the phase response at frequencies θ1 and θ2?
(d) Repeat (a) to (c) for non zero values of θ1 and θ2.
2. Read three audio signals in Matlab. You are free to choose any audio file from any source,
however, it may be noted that Matlab itself has many sample audio files. You can search for
these files in “Matlab Documentation/Help”. Your audio signal should not be too long, a
signal of few seconds duration is sufficient.
(a) Using the technique learnt in Problem 1, plot the magnitude spectrum of the three
signals you have read.
(b) Determine 5 most prominent frequencies in each of the three signals.
Hint: You may find some Matlab functions like audioread(), sound() etc. useful for this
problem. Refer to Matlab Documentation/Help for more details.
Hint: If it is possible, interpret the spectrum of the signal you have plotted. For example,
if you have sound from a string instrument, you may see some harmonics.
3. In this problem we will consider amplitude modulation. Consider a message signal m(t) =
cos(2 π fm t) and a carrier wave c(t) = cos(2 π fc t).
(a) Choose fm and fc such that fm < fc. Plot c(t), m(t) and the double side-band suppressed
carrier amplitude modulated wave.
(b) Plot the magnitude spectrum of the signals in (a).
(c) The complete receiver has a coherent detector and a low pass filter. We will skip the low
pass filter block, but plot the time domain signal and the frequency spectrum of the
output of the coherent detector.
(d) Repeat (a) to (c) for fm > fc. Do you see distortion in the output of the coherent detector
compared to the original message signal?
Deliverables: You are allowed to discuss the problem with others but code(s) and report should be
your own individual work. You should submit a soft-copy report by 20th January 2022 using the
google form: https://forms.gle/8sZJ3V1po7f7zGoC9 Please compile everything as a single PDF
file for submission. Your report should include (among other things):
1. The Matlab codes. You need not repeat the codes if you are only changing the parameters to
produce a different set of graphs.
2. The output produced by your code: graphs, numerical output etc.
Useful Sources Where You Can Get Help: There are a lot of online and offline sources where you
can learn about fft() function of Matlab:
1. The fft() documentation page in Matlab Help is a very good resource.
2. One of the many online resources, for example the Youtube tutorial video by David Dorran
“Using Matlab's fft function”, https://www.youtube.com/watch?v=dM1y6ZfQkDU can be
consulted. This useful tutorial tells you how the frequency bins produced at the output of
fft() should be interpreted.
3. To learn more about Discrete Fourier Transform and Fast Fourier Transform algorithm used
to implement it, you may refer to “Signals and Systems Using Matlab” by Luis F. Chaparro.