# Monson H. Hayes Statistical Digital Signal Processing Problem C3.3

Monson H. Hayes statistical Digital Signal Processing Problem C3.3 (Chapter 3 Computer Exercise): In this exercise we will look at how accurately the sample autocorrelation is in estimating the autocorrelation of white noise. The full problem is given below:

Loading…

```
%MATLAB Code for the above problem
clc;
clear;
close all;
m = 0;
v = 1;
x = m + sqrt(v) .* randn(1000,1); % Generates 1000 samples of zero mean, m=0 and unit variance, v=1
rxb = autocorr(x,100);
[acf,lags] = autocorr(x); %returns the lag numbers that MATLAB uses to compute acf
for k = 1:100
for m = 1:9
for n = 1:99
rx(k) = (1/1000) * sum(x(n+100*m) * x(n-k+100*m)); %segment white noise sequence into 10 d/t sequences
end
end
end
xd = m + sqrt(v) .* randn(10000,1);
rxd = autocorr(xd,100);
subplot(4,1,1),stem(x);
title('1000 Samples of zero mean unit variance white Gaussian noise');
ylabel('x(n)');
xlabel('n');
subplot(4,1,2),autocorr(x,'NumLags',100);
subplot(4,1,3),autocorr(rx,'NumLags',99);
subplot(4,1,4),autocorr(xd,'NumLags',100);
```