You are on page 1of 7

Lab2_ 1.02-2020.

1 Sistemas LTI, Convolución y Correlación

EL5002 – Análisis de Señales y Sistemas

Laboratorio 2: Guía
Indicaciones generales:

• La evaluación es estrictamente personal.


• Las respuestas y comentarios solicitados deben ir en la rúbrica.
• Responda las preguntas como:
• Pregunta1.m, Pregunta2.m, Reto.m. En los archivos m, enumere las respuestas como a., b. ...
usando comentarios.
• En la rúbrica, indique las referencias de respuesta en los archivos m. E.j. Si la rúbrica le pide
que coloque un código en un lugar, indique que está en la Pregunta 1 a. o b ... etc.
• Respete la estructura solicitada para archivos entregables (rúbrica y archivo.m).
• Nombre la rúbrica como: Rubrica_Lab2_102_CODIGODEALUMNO.pdf
• Envíe como un archivo zip o rar de los códigos y rubrica como:
Rubrica_Lab2_102_CODIGODEALUMNO.zip/rar

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.

e. Voltage/current signals used to drive systems could be noisy. Using a sampling


frequency of Fs = 900, generate a rectangular pulse wave 𝑥4 [𝑛] of amplitude a =
0:1.5, F = 1 kHz and duty cycle of 60%, for 2 seconds. Also generate a signal 𝑥5 [𝑛]

3 /7
Lab2_ 1.02-2020.1 Sistemas LTI, Convolución y Correlación

which is 𝑥4 [𝑛] corrupted by a random noise signal of amplitude 0.05. Synthesize an


impulse response ℎ15 [𝑛] of a moving average system and perform the filtering
operation
𝑦4 [𝑛] = filter(ℎ15 [𝑛], 1, 𝑥4 [𝑛])
Plot the three signals 𝑥4 [𝑛], 𝑥5 [𝑛], 𝑦4 [𝑛] together in one plot. Use grid, legend, labels
of the axes, makersize = 8, color and line types (𝑥4 [𝑛] = color = black, linewidth =
2), (𝑥5 [𝑛] = color = blue, linewidth = 1), (𝑦4 [𝑛] = color = red, linewidth = 2).
Follow the guide. Plot the x-axis in time. Comment on the result. Show the Matlab
codes and the plots.

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);

Show your Matlab code.

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.

f. Given the following recursive system

6 /7
Lab2_ 1.02-2020.1 Sistemas LTI, Convolución y Correlación

𝑦[𝑛] − 1.2𝑦[𝑛 − 1] − 2.2𝑦[𝑛 − 2] + 0.5𝑦[𝑛 − 3] + 1.42𝑦[𝑛 − 4] − 6𝑦[𝑛 − 5]


= 0.6𝑥[𝑛] − 1.5𝑥[𝑛 − 1] + 2.8𝑥[𝑛 − 2] − 3.15𝑥[𝑛 − 3] + 2𝑥[𝑛 − 4] + 𝑥[𝑛 − 5]

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

You might also like