MATLAB Assignmnet
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.