Full Name:

EEL 4750 / EEE 5502 (Fall 2019) – Code #de02 Due Date: Mar. 21, 2019

Question #1: (1 pts) How many hours did you spend on this homework?

Question #2: (4 pts) Correlation

Consider the expression for correlation (also known as cross-correlation) between x[n] and y[n],c[n] = x[?n] ? y[n] = X∞m=?∞x[m]y[n + m] (1)

Let us discuss some properties of the correlation function.

(a) Bounds of Convolution with Causal Signals. Show that if x[n] = 0 for n < 0 and

n > Nx ? 1 (i.e., casual with length Nx) and y[n] = 0 for n < 0 and n > Ny ? 1 (i.e., causal

with length Ny), then x[n] ? y[n] must satisfy

x[n] ? y[n] = 0 for n < 0 and n > Nx + Ny ? 2 .

That is, the result is causal with length Nx + Ny ? 1. Illustrations and correct intuition will

be acceptable. [Side note: This is a common DSP interview question.]

(b) Bounds of Correlation with Causal Signals. Show that if x[n] = 0 for n < 0 and

n > Nx ? 1 (i.e., casual with length Nx) and y[n] = 0 for n < 0 and n > Ny ? 1 (i.e., causal

with length Ny), then c[n] must satisfy

c[n] = 0 for n < ?(Nx ? 1) and n > Ny ? 1 .

That is, the result is non-causal with length Nx + Ny ? 1. Illustrations and correct intuition

will be acceptable.

(c) (EEE 5502 Only) Maximum of Auto-Correlation. Let y[n] = x[n]. Under this condition,

the correlation is known as the auto-correlation,

c[n] = X∞

m=?∞

x[m]x[n + m] (2)

For this condition, show that c[n] is largest when n = 0.

Hint: Use the Cauchy-Schwarz inequality, defined by

(3)

(d) (EEE 5502 Only) Maximum of Cross-Correlation. Let y[n] = x[n ? n0]. For this

condition, show that c[n] is largest when n = n0.

1

Question #3: (3 pts) Convolution

Create the following signals in MATLAB:

>> x1 = sin(pi/10*(0:19));

>> x2 = 2*(mod((0:19)/10,1)-0.5);

>> x3 = cos(pi/2*(0:19));

>> x4 = (-1).?(0:19);

And concatenate each of these four signals:

>> z = [x1 x2 x3 x4];

(a) Plot z using stem(z)

(b) Create three systems with impulse responses h1[n], h2[n], and h3[n] (or h1 and h2 and h3

in MATLAB) that are also 20 samples in length. Define these impulse responses as

h1[n] = δ[n]

h2[n] = δ[n ? 5]

h3[n] = δ[n ? 19]

Perform three convolutions in MATLAB between h1[n], h2[n], and h3[n] and x1[n] by running

>> y1 = conv(x1, h1)

>> y2 = conv(x1, h2)

>> y3 = conv(x1, h3)

Plot y1,y2,y3 using stem.

(c) The output signals now have a length of N = 39 instead of N = 20. Based on the previous

results, why is this necessary?

Question #4: (4 pts) The Auto-Correlation

(a) Perform a correlation of x1 with itself, i.e., an auto-correlation. Perform the auto-correlation

with the following commands:

>> a1 = conv(fliplr(x1), x1);

>> lag = -(20-1):(20-1);

>> stem(lag, a1)

>> xlabel(’Lag [samples]’)

>> ylabel(’Amplitude’)

As shown in Question #1, the auto-correlation is always maximum at n = 0. The x-axis for

a correlation is referred to as the “lag” or ”delay.”

(b) Repeat this process for x2[n], x3[n], x3[n], and x4[n]. Plot the auto-correlations (like above)

for all four signals.

2

(c) Perform four correlations between z[n] and x1[n]; z[n] and x2[n]; z[n] and x3[n]; and z[n] and

x4[n]. Hence you can plot the result z1 with

>> z1 = % the correlation, determine yourself based prior

results

>> n = % the x-axis, determine yourself based on Question #2

>> stem(n, z1)

>> xlabel(’Lag [samples]’)

>> ylabel(’Amplitude’)

Plot the correlations for all four signals.

(d) Based on your results, how can we use this result to determine the location of our four signals

x1[n], x2[n], x3[n], x4[n] buried in a large signal z[n]?

Question #5: (5 pts) Finding a Hidden Signal

In radar, communications, and other systems, we need to find received signals that are similar to

what we transmitted. In communication systems, these signals correspond to messages. In radar,

these signals tell us about the surrounding environment. Yet, in communications, we may not know

when the signal will arrive. In radar systems, the signal’s location in time tells us how far away

a target is. Hence, we need to search across time to find the signals of interest. This is common

accomplished through the cross-correlation.

In this question, we will use cross-correlation to locate the position of a hidden signal in noisy data.

Included with the zip file is a p-file (an obfuscated m-file) function

>> [message, code] = get_message(ufid);

This function provides a message with a hidden code. Your objective is to determine the location

of the first sample of the code with cross-correlation. Submit your .m file used to achieve this.

Also, plot your resulting cross-correlation and display the first sample location.

Note: This works well for small data sets (like the example here), but this is extremely slow for

larger datasets (like audio recordings). In this next coding assignment, we will see how to speed this

up with the discrete Fourier transform.

3

版权所有：留学生编程辅导网 2018 All Rights Reserved 联系方式：QQ:99515681 电子信箱：99515681@qq.com

免责声明：本站部分内容从网络整理而来，只供参考！如有版权问题可联系本站删除。