function C_I=correlation_integral(X,M,r,qs)
%the function is used to calculate correlation integral
%C_I:the value of the correlation integral
%X:the reconstituted state space, is a m*M matrix
%m:the embedding demention
%M:M is the number of embedded points in m-dimensional space
%r:the radius of the Heaviside function,sigma/2<r<2sigma
%calculate the sum of all the values of Heaviside
%skyhawk
sum_H=zeros(1,M);
for i=1:M
for j=1:M
if j==i
continue;
end
d=norm((X(:,i)-X(:,j)),inf);%calculat the distances of each two points in matris M with sup-norm
sita=heaviside(r-d);%calculate the value of the heaviside function
sum_H(i)=sum_H(i)+sita;
end
sum_H(i)=sum_H(i)^qs;
end
C_I=sum(sum_H);%the value of correlation integral
function X=reconstitution(data,N,m,tau)
%该函数用来重构相空间
% m 为嵌入空间维数
% tau 为时间延迟
% data 为输入时间序列
% N 为时间序列长度
% X 为输出,是m*n 维矩阵
M=N-(m-1)*tau;%相空间中点的个数
for j=1:M %相空间重构
for i=1:m
X(i,j)=data((i-1)*tau+j);
end
end |