Professional Documents
Culture Documents
Laboratorio 2: Guía
Indicaciones generales:
Pregunta 1:
a. The moving average filter is a simple Low Pass FIR filter commonly used for
smoothing an array of sampled noisy signal, it is given by
𝑀−1
1
𝑦[𝑛] = ∑ 𝑥[𝑛 − 𝑘]
𝑀
𝑘=0
Where 𝑀 is the order of the filter. A M-point Moving Average FIR filter takes the
current and previous M-1 samples of input and calculates the average.
Calculate the response of the system 𝑦[𝑛] (M order 5) to the unit impulse input
𝑥[𝑛] = 𝛿[𝑛], thus obtain ℎ[𝑛]. Hint: consider 0 ≤ 𝑛 ≤ 4
b. Generate the unit impulse sequence 𝛿[𝑛] for −10 ≤ 𝑛 ≤ 10 and use it, together with
ℎ[𝑛] obtained in question a, to verify the sequence 𝑦[𝑛] obtained in question, a by
using convolution
𝑦[𝑛] = ℎ[𝑛] ∗ 𝛿[𝑛]
Graph the three signals 𝛿[𝑛], ℎ[𝑛] and 𝑦[𝑛] together in one plot using subplot. Use
stem, xtick, ytick, grid, legend, labels of the axes, line width = 2, makersize = 8, and
colors ( 𝛿[𝑛] = color = black), ( ℎ[𝑛] = color = blue), ( 𝑦[𝑛] = color = red). Plot the
x-axis in time. Show the Matlab codes and the plots.
1 /7
Lab2_ 1.02-2020.1 Sistemas LTI, Convolución y Correlación
c. Create the following DT signals with 0 ≤ 𝑛 ≤ 100, 𝑓1 = 0.05 (low freq), 𝑓2 = 0.1
(high freq)
𝑥1 [𝑛] = sin(2𝜋𝑓1 𝑛)
𝑥2 [𝑛] = sin(2𝜋𝑓2 𝑛)
𝑥3 [𝑛] = 𝑥2 [𝑛] + 𝑥2 [𝑛]
Graph the three signals together in one plot using subplot. Use grid, legend, labels
of the axes, line width = 2, makersize = 8, color and line types (𝑥1 [𝑛] = color =
black, line = o−), (𝑥2 [𝑛] = color = blue, line = o−), (𝑥3 [𝑛] = color = red, line =
o−). Plot the x-axis in time. Show the Matlab codes and the plots.
2 /7
Lab2_ 1.02-2020.1 Sistemas LTI, Convolución y Correlación
d. Given 𝑥3 [𝑛], synthesize the impulse response ℎ10 [𝑛] of the moving average system
and perform the convolution. Hint ℎ𝑀 [𝑛] = ones(1, 𝑀)/𝑀
𝑦2 [𝑛] = 𝑥3 [𝑛] ∗ ℎ10 [𝑛]
Plot the two signals 𝑥1 [𝑛], 𝑦2 [𝑛] together in one plot using subplot. Use grid, legend,
labels of the axes, linewidth = 2, makersize = 8, color and line types (𝑥1 [𝑛] = color =
black, line = −), (𝑦2 [𝑛] = color = red, line = o−). Follow the guide. Plot the x-axis
in time. Comment on the result. Show the Matlab codes and the plots.
3 /7
Lab2_ 1.02-2020.1 Sistemas LTI, Convolución y Correlación
Pregunta 2:
a. Dual Tone Multi Frequency (DTMF) signals encode each key of a modern
telephone by adding two sinusoidal frequencies as shown in the picture below. We
will try to identify the tones that make up a DTMF melody by applying the correlation
of a stored melody with pure DTMF tones which we generate.
Create a function x = tono2(f1,f2,T,fs) which takes the two frequencies, f1, f2, the
period in seconds T, and the sampling frequency, fs. With this it returns the
corresponding digit of the keypad x. e.g.
4 /7
Lab2_ 1.02-2020.1 Sistemas LTI, Convolución y Correlación
fs = 9000;
T = 0.1;
t9 = tono2(852,1477,T,fs);
b. Load the file 'DTMFtone3.wav' and plot x-axis in time. Use axis to set the limits as
in the guide. Use [x,fs] = audioread (); Show your Matlab code and plot.
c. Using your function tono2.m generate the DTMF tones corresponding to the digits
'9', '0', '2', '1', '8', '4', '3', '5' with T= 0.15 s and the fs read from b. Additionally create
a silence of T = 0.15 s.
d. Make the correlation of the melody read in b with each of the tones created in c.
Use the command [corr, pos] = xcorr (signal, segment). Using the normalized
correlation metric, graph the resulting 7 correlations in a single figure using the
subplot command. Plot the x-axis for each in time. Follow the guide to use the
necessary labels.
5 /7
Lab2_ 1.02-2020.1 Sistemas LTI, Convolución y Correlación
e. From the plot in question d, indicate which numbers were used in the initial melody
and the time instants in which each begins. Finally, try to replicate the the original
melody using the tones you created. To compare it to the original signal plot both
signals in one graph, 𝑥6 is original signal and 𝑥7 is your generated signal. Use
legend, labels of the axes, color and line types (𝑥6 [𝑛] = color = black, linetype =
−), (𝑥7 [𝑛] = color = blue, linetype = o). Show the Matlab codes and the plot.
6 /7
Lab2_ 1.02-2020.1 Sistemas LTI, Convolución y Correlación
Using Matlab calculate the impulse response ℎ𝑓 [𝑛] of the system. Use a unit
impulse signal of x [n] 0 ≤ 𝑛 ≤ 300. Plot the output signal. Use filter, legend, stem,
labels of the axes. Show the Matlab codes and the plot. Comment on the stability
of the system.
7 /7