%% Normalized Cross-Correlation
% Compute and plot the normalized cross-correlation of vectors x and y with unity peak, and specify a maximum lag of 10.

n = 0:15;
x = 0.84.^n;
y = circshift(x,5);
[c,lags] = xcorr(x,y,10,'normalized');
stem(lags,c)

% Copyright 2018 The MathWorks, Inc.