Você está na página 1de 6

DA NANG UNIVERSITY OF SCIENCE AND TECHNOLOGY

FACULTY OF ADVANCED SCIENCE AND TECHNOLOGY

EE 416
Midterm
REPORT
Class: 15ECE-CE

Members: Vo Hoang Chuong


C3.3:
a)
Matlab script:
L=1000;
mu=0;
sigma=1;
X=sigma*randn(L,1)+mu;

plot(X);
title(['White noise : \mu_x = 0 ',' \sigma^2 = 1'])
xlabel('Number of samples')
ylabel('Sample Values')
grid on;

Result:

Analysis: We obtained 1000 random samples of zero mean unit variance white Gaussian noise
with µx=0, σ = 1.
b)
Matlab script:
h = 1/3*ones(3,1);
x = randn(1000,1);
y = filter(h,1,x);
[xc,lags] = xcorr(y,100,'biased');
Xc = zeros(size(xc));
Xc(99:103) = [1 2 3 2 1]/9*var(x);
stem(lags,xc,'filled')
hold on
stem(lags,Xc,'.','linewidth',2)
lg = legend('Sample autocorrelation','Theoretical autocorrelation');
lg.Location = 'NorthEast';
lg.Box = 'off';
hold off

Result:

Analysis:
We observe that the magitude of the sample autocorrelation is approximately 0.2 unit lower
than the autocorrelation sequence 𝑟𝑥 (𝑘) = 𝛿(𝑘)
c)
h = 1/3*ones(3,1);
x = randn(100,1);
y = filter(h,1,x);

[xc,lags] = xcorr(y,100,'biased');
Xc = zeros(size(xc));
Xc(99:103) = [1 2 3 2 1]/9*var(x);

for i = 1:9
x1 = randn(100,1);
y = filter(h,1,x1);
[xc1,lags] = xcorr(y,100,'biased');
xc = xc + xc1;
Xc1 = zeros(size(xc1));
Xc1(99:103) = [1 2 3 2 1]/9*var(x1);
Xc = Xc + Xc1;
end
xc = xc/10;
Xc = Xc/10;
stem(lags,xc,'filled')
hold on
stem(lags,Xc,'.','linewidth',2)
lg = legend('Sample autocorrelation','Theoretical autocorrelation');
lg.Location = 'NorthEast';
lg.Box = 'off';
hold off

Result:

Analysis:
We separated the white noise segment into 10 different white noise sequences having the
length of 100 samples.
After taking the average of 10 sequences’ sample autocorrelations, we obtained the results that
are approximate to the previous ones. This maybe due to the fact that we create the random
value continuously. Therefore the samples are not the same through the estimation.
In this occasion, we have the sample autocorrelation’s value is farther to the real autocorrelation
sequence.
d)
Matlab script:
h = 1/3*ones(3,1);
x = randn(10000,1);
y = filter(h,1,x);

[xc,lags] = xcorr(y,100,'biased');
Xc = zeros(size(xc));
Xc(99:103) = [1 2 3 2 1]/9*var(x);
stem(lags,xc,'filled')
hold on
stem(lags,Xc,'.','linewidth',2)
lg = legend('Sample autocorrelation','Theoretical autocorrelation');
lg.Location = 'NorthEast';
lg.Box = 'off';
hold off

Result:

Analysis:
Comparing to part b, we observe that this result has higher accuracy in estimating the
autocorrelation of the sample sequence.
In conclusion, the number of sample affects directly the accuracy of autocorrelation method.
If we separate the samples and take average, we will still obtain the same result because the
number of sample doesn’t change.
If we increase the number of sample, the accuracy of the sample autocorrelation method will
increase. When the number of sample is infinte, the accuracy of the sample autocorrelation
method will become 1.

Você também pode gostar