基于Lorenz时间序列求时间延迟,请指教!
与陆振波博士工具箱CC算法采用相同的数据,但结果差异很大,附上源代码,帮我看看,不胜感谢!陆博士:dela_S_mean第一个极小值 时间延迟tao=10
采用相同的Lorenz序列3000个数据,我的结果:dela_S_mean第一个极小值 时间延迟tao=3
matlab源代码如下:
clear all;
data=load('a2.txt') ;
data=data(:,1)';
%************************************************
N=length(data);
max_d=12;%the maximum value of the time delay
sigma=std(data);%calcute standard deviation s_d
s_m_t=zeros(5,12);% 存放△S(m,t),m取2到5,最大时间延迟为10
s1=;%存放S(m,t)之和
for t=1:max_d
for m=2:5
s_t2=;%存放S(m,rj,t) j=1,2,3,4
for g=1:4
r=sigma*g/2;
p=fix(N/t);
data_d=zeros(t,p);
for i=1:t
for j=1:p
data_d(i,j)=data(i+(j-1)*t);
end
end %将时间序列分解成t个不相交的时间序列
N_d=p;
s_t3=0;
for i=1:t
Y=data_d(i,:);
C_1(i)=correlation_integralxu(Y,N_d,r);%计算C(1,N_d,r,t)
X=reconstitutionxu(Y,N_d,m,t);%相空间重构
N_r=N_d-(m-1)*t;
C_I(i)=correlation_integralxu(X,N_r,r);%计算C(m,N_r,r,t)
s_t3=s_t3+(C_I(i)-C_1(i)^m); %求S(m,N,r,t)
end
s_t2(g)=s_t3/t;
end
s1(t)=s1(t)+sum(s_t2)
s_m_t(m,t)=max(s_t2)-min(s_t2)
end
end
for i=1:max_d
dela_s_mean(i)=sum(s_m_t(:,i))/4;
s_mean(i)=s1(i)/16;
end
figure;
t=1:max_d;
plot(t,dela_s_mean,'*',t,dela_s_mean);title('delta S mean');
其中两个函数:
function C_I=correlation_integral(X,M,r)
%the function is used to calculate correlation integral
sum_H=0;
for i=1:M-1
for j=i+1:M
d=norm((X(:,i)-X(:,j)),inf);%calculat the distances of each two points in matris M with sup-norm
if (r-d)<0
sita=0;
else sita=1;
end
sum_H=sum_H+sita;
end
end
C_I=2*sum_H/(M*(M-1));%the value of correlation integral
function X=reconstitution(data,N,m,tau)
%该函数用来重构相空间
M=N-(m-1)*tau;%相空间中点的个数
K=zeros(m,M);
for j=1:M %相空间重构
for i=1:m
K(i,j)=data((i-1)*tau+j);
end
end
X=K;
以上代码也是改于网络源代码,请指教,谢谢!!
您这个程序运行不过去啊
页:
[1]