马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
N=length(data);
max_d=200;%the maximum value of the time delay
sigma=std(data);%calcute standard deviation s_d
for t=1:max_d
s_t=0;
delt_s_s=0;
for m=2:5
s_t1=0;
for j=1:4
r=sigma*j/2;
data_d=disjoint(data,N,t);%将时间序列分解成t个不相交的时间序列
N_d=size(data_d);
s_t3=0;
for i=1:t
i;
Y=data_d(i,:);
C_1(i)=correlation_integral1(Y,N_d,r);%计算C(1,N_d,r,t)
X=reconstitution(Y,N_d,m,t);%相空间重构
N_r=N_d-(m-1)*t;
C_I(i)=correlation_integral(X,N_r,r);%计算C(m,N_r,r,t)
s_t3=s_t3+(C_I(i)-C_1(i)^m);%对t个不相关的时间序列求和
end
s_t2(j)=s_t3/t;
s_t1=s_t1+s_t2(j);%对rj求和
end
delt_s_m(m)=max(s_t2)-min(s_t2);%求delt S(m,t)
delt_s_s=delt_s_s+delt_s_m(m);%delt S(m,t)对m求和
s_t0(m)=s_t1;
s_t=s_t+s_t0(m);%S对m求和
end
s(t)=s_t/16;
delt_s(t)=delt_s_s/4;
s_cor(t)=delt_s(t)+abs(s(t));
end
fid=fopen('result.txt','w');
fprintf(fid,'%f %f %f %f/n',t,s(t),delt_s(t),s_cor(t));
fclose(fid);
t=1:max_d;
plot(t,s,t,delt_s,'.',t,s_cor,'*')
function C_I=correlation_integral(Y,M,r)
% 此函数用于计算关联积分,取无穷范数
% Y为重构的相空间
% M为相空间中点的个数
% r为搜索半径
% Y为输出,是M*m维矩阵
C=0;
for i=1:M-1
for j=i+1:M
d=norm((Y(:,i)-Y(:,j)),inf); % 计算状态空间中每两点之间的距离,取无穷范数
if r-d>=0
C=C+1;
end
end
end
C_I=2*C/(M*(M-1));
%%%%%%%%%%%%%%%%%%%%%%%%%
??? Error using ==> mtimes
Inner matrix dimensions must agree.
Error in ==> correlation_integral1 at 17
C_I=2*C/(M*(M-1));
Error in ==> c_c at 18
C_1(i)=correlation_integral1(Y,N_d,r);%计算C(1,N_d,r,t)
这是怎么回事啊,望各位指点 |