|
楼主 |
发表于 2008-11-28 16:38
|
显示全部楼层
下面是我求最大le所用的 程序:
function lambda_1=largest_lyapunov_p3(data,N,m,tau,P,delt_t)
%function lambda_1=largest_lyapunov_exponent(data,N,m,tau,P,delt_t)
d_length=[];
d_content=[];
Y=rreconstitution(data,N,m,tau);
M=N-(m-1)*tau;
idx_j=0;
for j=1:M
d_min=10000;
for jj=1:M
d_s=0; %寻找相空间中每个点的最近距离点,并记下该点下标
if abs(j-jj)>P %限制短暂分离
d_s=sum(abs(Y(j)-Y(jj)));
if d_s<d_min
d_min=d_s;
idx_j=jj;
end
end
end
if ((M-j)>(M-idx_j));%计算点j的最大演化时间步长i
max_i=M-idx_j;
else
max_i=M-j;
end
d_length=[d_length,max_i];
for k=1:max_i %计算点j与其最近邻点在i个离散步后的距离
d_j_i=0;
d_j_i=norm(Y(j+k)-Y(idx_j+k));
d_content=[d_content,d_j_i];
end
end
%对每个演化时间步长i,求所有的j的lnd(i,j)平均
y=[];
for i=1:max(d_length)
S_j_i=0;
sum_former=0;
Count=0;
for j=1:M
if j==1
former=0;
else
former=d_length(j-1);
end
sum_former=sum_former+former;
if i<=(d_length(j))
if d_content(sum_former+i)~=0
S_j_i=S_j_i+log(d_content(sum_former+i));
Count=Count+1;
end
end
end
y=[y,S_j_i/(Count*delt_t)]; %对每个演化时间步长i,求所有的j平均
end
XX=1:length(y);
figure;
plot(XX,y(XX),'-','markersize',1);hold on;——————————【上面的图是从这儿画出来的】
linear=input('请输入线形部分的长度');
XX1=1:linear;
pp=polyfit(XX1,y(XX1),1);
lambda_1=pp(1)
yp=polyval(pp,XX1);
figure;
plot(XX1,yp,'r--');
—————————————————————————————————————————
data=[23.5435, 23.6017, 21.8659, 19.2185, 20.9959, 26.7665, 26.6912, 23.4856, 19.2430, 19.5763, 24.2530, 24.1166, 21.6433, 17.4141, 18.7429, 23.9004, 24.6566, 23.8338, 21.1195, 23.0495, 28.8246, 29.3141, 26.3933, 21.9029, 22.2787, 26.3822, 24.8792, 21.4659, 17.0669, 17.5331, 21.9018, 22.6303, 21.1561,17.8500, 19.7364, 24.6838, 25.5897, 22.8404, 19.1922, 20.1660, 23.8037, 23.7511, 20.6029, 16.2297, 16.0250, 18.9570, 18.8982, 16.5790, 13.4053, 13.6338, 16.3938, 15.5662, 13.5325, 10.8850, 11.2450, 14.2391, 14.3415, 13.0766, 10.9799, 11.6193, 14.5686, 14.9380, 14.0089, 12.3639, 14.1371, 19.0509, 20.7442, 20.9807, 18.3807, 20.5496, 25.4439, 26.2623, 22.9875, 18.2714, 18.7077, 22.0112, 21.8264, 19.2434, 15.8194, 17.0474, 20.9267,21.1197, 19.0166, 15.6522, 16.7208, 20.4368,20.5837,19.3010,16.3430, 17.4055, 21.4690,22.0125, 20.5400,17.2587, 18.5310,23.2943,24.2489,22.4947,18.1032, 19.1325, 23.2398, 22.3970, 19.5081, 15.3898, 15.5401, 18.5237, 18.3063, 16.2690, 13.3814, 14.3685, 17.7273, 18.0680, 17.0469, 14.5307, 15.3806, 19.3015, 19.7366, 17.8777, 14.6004, 15.3362, 18.5283, 18.4084, 16.3710, 13.0996, 13.7063, 17.5014];
m=12;tau=3;delt_t=0.008;N=length(data);P=63;
lambda_1=largest_lyapunov_p3(data,N,m,tau,P,delt_t) |
|