www.gusucode.com > 混沌时间序列工具箱 > 混沌时间序列工具箱/ChaosToolbox1p0_trial/DelayTime_Others/AutoCorrelation.m
function [tau] = AutoCorrelation(X,maxLags,IsPlot) % 自相关法求混沌时间序列重构的时间延迟 % 输入参数:X 混沌时间序列 % maxLags 最大时间延迟 % 输出参数:tau 时间延迟 ACF = autocorr(X,maxLags); % 求自相关函数 ACF = ACF(2:end); % 将第一个 tau=0 的情况去掉 % 自相关函数下降到初始值的 1-1/e 时的 tau 即为所求 (tau 从 1 开始) gate = (1-exp(-1))*ACF(1); temp = find(ACF<=gate); if (isempty(temp)) disp('err: max delay time is too small!') tau = []; else tau = temp(1); end if IsPlot figure; plot(1:length(ACF),ACF) xlabel('Lag'); title('自相关法求时延'); end