In this part of the assignment, you will need to calculate thecross-correlation of two random signals. In the Appendix: Part II,we include the function ccorr that gives you the crosscorrelationof two input vectors.
MATLAB provides other built-in function that may be useful forthis part of the assignment
• max: gives you the maximum value of a vector. For moreinformation type help max
find: gives you the index corresponding to a value of a vector.For more information type help find.
Finally, you will also need to use a linear filter in Exercise3. You can use the function linfilt that you already used inMA2.
You can calculate the cross-correlation between two randomsignals in MATLAB by using the function ccorr given in theAppendix: Part II. As an example, consider two random signals x(t)and y(t), which are both modeled as white Gaussian random processeswith mean 0 and variance 1. We plot the cross-correlation functionRxy(? ) of the random signals x(t), y(t) by applying the followingMATLAB code:
t = -10:0.01:9.99;
x = randn(1, length(t));
y = randn(1, length(t));
[cc, tau] = ccorr(x,y,t);
plot(tau,cc);
In the same way you can plot the autocorrelation of signal x(t)[ac, tau] = ccorr(x,x,t); plot(tau, ac);
Now assume that y(t) is the output of a linear filter withimpulse response h(t) = |sinc(t ? 2)|
where the input x(t) is a white Gaussian random signal with mean0 and variance 1. Create an M-file to:
(a) Calculate y(t) using the function linfilt and plot x(t) andy(t) where t ranges from ?10 to 9.99, using 0.01 increments. NOTE:y(t) is the output signal of the filter, so if N is the length ofthe vector t, the length of y(t) is N + N ? 1 (convolution of twofunctions with length N). You will have to find the indices thatcorrespond to t from ?10 to 9.99.
(b) Plot the cross-correlation function Rxy(? ).
(c) Plot the autocorrelations Rxx(? ) and Ryy(? ) of x(t) andy(t), respectively.