n = 0:15;
x = 0.84.^n;
y = circshift(x,5);
[c,lags] = xcorr(x,y);
stem(lags,c)
xlabel('lag')
ylabel('r')
or more simply,
plot(lags, c, '-o')
![190715 134831-Figure 1.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/229900/190715%20134831-Figure%201.jpeg)
This shows a maximum correlation at lag -5 which makes sense since we circularly shifted the data by 5 units.