ELEG 320L: Signals and Systems Lab
LAB 5 – EXERCISES
Exercise 1
Write a function that convolves two sequences of arbitrary lengths without using the
built-in convolution function: conv(a,b). Using time markers tic and toc,
compare the performance of your code with the built-in conv function.
Exercise 2
Cross correlation of two discrete-time signals is defined by:
π[π] = π₯[π] β β[βπ]
Write a function crosscorrelation(x,h) to find the cross-correlation of two
signals of arbitrary length and arbitrary starting points. Using time markers tic and
toc, compare the performance of your code with the built-in xcorr function.
Exercise 3
The auto-correlation of a discrete-time signal is defined by:
π[π] = π₯[π] β π₯[βπ]
Generate a random Gaussian noise signal π₯[π] using the function randn. Use the
function crosscorrelation(x,h) of Exercise 2 to find the auto-correlation of the
noise signal. Determine the effect of the length of the noise signal on the auto-
correlation of the signal.