%% Autocorrelation of Vector
% Compute and plot the estimated autocorrelation of a vector x. The largest spike occurs at zero lag, when x matches itself exactly.

n = 0:15;
x = 0.84.^n;
[c,lags] = xcorr(x);
stem(lags,c)

% Copyright 2018 The MathWorks, Inc.