EEE - 321: Signals and Systems Lab Assignment 3
EEE - 321: Signals and Systems Lab Assignment 3
EEE - 321: Signals and Systems Lab Assignment 3
Please carefully study this assingment before coming to the laboratory. You may begin
working on it or even complete it if you wish, but you do not have to. There will be short
quizzes both at the beginning and end of the lab session; these may contain conceptual,
analytical, and Matlab-based questions. Within one week, complete the assignment in the
form of a report and turn it in to the assistant. Some of the exercises will be performed
by hand and others by using Matlab. What you should include in your report is indicated
within the exercises.
Note: Along with this pdf file, you will find a .zip file containing two Matlab functions
named FT.m and IFT.m and a music wav file named furelise. Unzip the archive and place
all files contained in it under the current directory of Matlab.
1 Part 1
In this lab, you are going to see two common daily life applications in which the concepts
you learned in the signals and systems course are used. In this part, you will see the first
of these applications: transmission and detection of Dual Tone Multi Frequency (DTMF)
signals. In Part 2, you will see the second application: cancelation of the echoes from a
sound signal. Dual tone multi frequency (DTMF) is the name of the standard technique
1
used over analog telephone lines to transmit and receive the information about the dialed
phone number. Examine the following chart: The interpretation of this chart is as follows:
Suppose you press the button for 5 on your phone for 0.25 seconds. Then, the DTMF trans-
mitter on your phone sends the following signal
(
cos(2π770t ) + cos(2π1336t ) for 0 ≤ t ≤ 0.25,
x(t ) =
0 otherwise
At the receiver (that is the telephone exchange - telefon santrali), the DTMF receiver exam-
ines the incoming signal, tries to understand which frequencies were transmitted, so tries
to decide which number is dialed.
In this part, you will write a function that prepares the analog signal to be transmitted when
a phone number containing only numerical digits 0,1,...,9 is dialed.
Assume that for each button, the duration of the transmitted signal is only 0.25 seconds.
Thus, for instance, if the dialed number is 2017, you should prepare the following signal:
cos(2π697t ) + cos(2π1336t ) for 0 ≤ t ≤ 0.25,
cos(2π941t ) + cos(2π1336t ) for 0.25 ≤ t ≤ 0.5,
x(t ) = cos(2π697t ) + cos(2π1209t ) for 0.5 ≤ t ≤ 0.75,
cos(2π852t ) + cos(2π1209t ) for 0.75 ≤ t ≤ 1,
0 otherwise
Note that if N digits are dialed, the duration of the final signal is 0.25N . Of course, in Matlab
we can only compute the samples of x(t ). Your code should compute the samples within
0 ≤ t ≤ 0.25N using the sampling period T s = 1/8192.
2
Your function should look like
• Number of size 1 × N contains the phone number that is dialed. For instance, if the
dialed number is 2017, you should have Number=[2 0 1 7].
Once your code is ready to run, prepare the signal for your own cellular phone number and
listen to it using the Matlab command soundsc(x,8192). Does what you listen to sound
familiar to you? Include your code and comments to your report.
(Note: Before starting this part, clear everything in the workspace issuing the command
clear all. Place the m-files named FT.m and IFT.m under the current directory.)
First run x=DTMFTRA(Number), where Number includes the last 4 digits of your ID num-
ber in reverse order (i.e., for 20151234, choose Number = [4 3 2 1]). Now, suppose we are on
the receiver side, x is the received signal and assume we do not know what x includes. You
can listen to it typing soundsc(x,8192).
where ( f r 1 , f c 1 ) determine the first digit, ..., ( f r 4 , f c 4 ) determine the last digit. To under-
stand the dialed phone number, we need to find ( f r 1 , f c 1 ), ..., ( f r 4 , f c 4 ).
The Fourier transform operation is a powerful tool to analyze the frequency content of sig-
nals, and we will make use of it to understand the frequency content of the received signal.
For a particular frequency ω, X (ω) denotes the contribution of the complex exponential
e j ωt to the signal x(t ). As an analogy, X (ω) shows how many grams of e j ωt we need to use
to form x(t ).
3
Answer the following questions and include the answers to your report. You can directly
use the result given in the book for part a. For the other parts show your work clearly. In
these parts, you can directly use the definition of the Fourier transform. However, if it is
possible, it is recommended to use the properties of the Fourier transform.
Type X=FT(x). Then create a frequency array using the following code:
omega=linspace(-8192*pi,8192*pi,8193);
omega=omega(1:8192);
This piece of code will create a frequency array in angular frequency. You will learn the
details of this code when you learn the details of sampling. Then type plot(omega,abs(X)).
You will obtain the plot of the magnitude of the Fourier transform of x(t ) computed over
the grid specified by omega. Include the plot to the report. Examine the figure, in partic-
ular, determine the frequencies where you see the peaks. Are the frequencies where the
peaks occur the ones used by DTMF transceivers? (Here you should consider the conver-
sion of cyclic frequency (with units of Hertz) to angular frequency (with units of rad/sec)).
If yes, can you understand ONLY from this figure what the dialed number is? Include your
answers to the report.
This operation can be seen as a multiplication of x(t ) by a rectangular signal. First write the
analytical expression of this rectangular signal. Then, in Matlab, generate this rectangular
4
signal and by multiplying by x(t ), create x 1 (t ). Make sure that the size of the array for x 1 (t )
is the same with the size of the array for x(t ). Include your code to the report.
Now compute X 1 (ω) using the FT.m function and plot its magnitude against ω. Include
the plot to the report. Look again to the frequencies where the peaks occur. This time, can
you understand what is the first digit that is dialed? Include the answer to your report.
Continue in this manner and find the remaining three digits. Explain these steps clearly.
Why do you think that the first method (looking at X (ω) at once) does not work but the
second method (looking at X 1 (ω) ,...,X 4 (ω) separately) works? Write your answer to the
report.
2 Part 2
(Note: Before starting this part, clear everything in the workspace issuing the command
clear all. Place both the m-files named FT.m and IFT.m and the wav file furelise under the
current directory.)
In this part you will learn how to add an echo to an audio signal using Matlab. Note that
echoes are essentially delayed and possibly attenuated versions of the original signal. You
will first load a music wav file named furelise. At this point learn more about Matlab func-
tion wavread and how it can be used to extract the sampling frequency of furelise wav file.
Initially you will load the original wav file signal and save it in the workspace named as x.
From its sampling frequency and length of the signal find the total duration, T of x. Listen to
it in Matlab using soundsc function. Include the code and your calculated signal duration T
to your report. You will then create a delayed version of x and multiply it by an attenuation
constant A i to reduce the amplitude of the echo signal. Finally the delayed and attenuated
signal are added back to the original signal to get the echo effect of the audio signal.
Now synthesize an echo signal y from the original signal x. It can be represented as
M
X
y(t ) = x(t ) + A i x(t − t i ) , (2)
i =1
where the summation simulates multiple echoes. M represent the number of the echo, A i
denotes the amplitude of the i th echo and t i denotes the time delay for the i th echo with
t i > 0.
First, answer the following questions and include your answers to your report together with
a clear derivation.
• a) Find h(t ) such that y(t ) = x(t ) ∗ h(t ) where ∗ denotes the convolution operation.
Note that in this way, we describe the process that relates x(t ) to y(t ) as a linear time
invariant (LTI) system. The impulse response of this LTI system is h(t ).
5
• b) What is the frequency response of this system? That is, what is H (ω), i.e., the
Fourier transform of h(t )?
Now, generate the time variable t by issuing the command t=0:1/F s :T − 1/F s ;, where F s is
the sampling frequency of original signal x and T is the duration of the signal. This variable
indicates the sampling points in time of your furelise. Then generate y from x by assuming
M = 4, A i = 0.75, 0.5, 0.25, 0.15 and t i = 0.75, 1.5, 2.25, 3 seconds. Crop the delayed signals so
that each of them is T seconds long. Plot x(t ) vs. t and y(t ) vs. t in separate figures. Clearly
indicate the titles and labels. Also listen to y(t ) and describe the sound that you listened.
Now you will extract the original signal from the disturbed signal using Fourier domain
relations. In order to do this, compute the Fourier transform of y(t ) using the command
Y=FT(y). Then, compute H (ω) over the grid specified by omega, which will be generated
typing
Next, compute h(t ) typing h=IFT(H). Plot h(t ) vs. t and |H (ω)| vs. ω in separate figures.
Include your plots to your report together with the appropriate labels and titles. Then, us-
ing your result in item d, compute X e (ω), where e indicates estimated X. Finally, compute
x e (t ) from X e (ω) typing xe=IFT(Xe). Then listen to xe(t ). Is the estimated audio different
than your original audio. Plot xe(t ) and include the plot to your report. Also include your
comments and observations to the report.