2020-11-04 19:22:05 +00:00
|
|
|
function [cep_autocorr, cep_lags] = autocorr(signal, max_lags, time, Fs)
|
|
|
|
|
2020-11-06 19:08:42 +00:00
|
|
|
% [cep_autocorr, cep_lags] = xcorr(signal, round(max_lags), 'coeff');
|
|
|
|
[cep_autocorr, cep_lags] = xcorr(signal, 'coeff');
|
2020-11-04 19:22:05 +00:00
|
|
|
|
|
|
|
if time
|
|
|
|
cep_lags = 1000*cep_lags/Fs; % turn samples into ms
|
|
|
|
end
|
|
|
|
|
|
|
|
plot(cep_lags, cep_autocorr)
|
|
|
|
grid
|
|
|
|
if time
|
|
|
|
xlabel('Delay (ms)')
|
|
|
|
else
|
|
|
|
xlabel('Delay (samples)')
|
|
|
|
end
|
|
|
|
ylabel('Normalized Autocorrelation')
|
|
|
|
title('Autocorrelation')
|
|
|
|
xlim([min(cep_lags) max(cep_lags)]);
|
|
|
|
|
|
|
|
end
|
|
|
|
|