%the function is used to calculate correlation integral
%C_I:the value of the correlation integral
%X:the reconstituted state space,M 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=0;
for i=1:M
fprintf('%d/%d\n',i,M);
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
sita=heaviside(r,d);%calculate the value of the heaviside function
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 为嵌入空间维数
% 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 是啊,没有reconstitution和correlation_integral等于没有给 时间延迟tau用什么方法算得啊?有相关程序吗? 我用了correlation_integral函数,但是出现错误??? Undefined function or variable 'heaviside'.
Error in ==> D:\Program Files\matlab\work\correlation_integral.m
On line 15==> sita=heaviside(r,d);%calculate the value of the heaviside function
Error in ==> D:\Program Files\matlab\work\G.m
On line 326==> C(k)=correlation_integral(Y,M,r);%calculate the correlation integral
回复 7楼 realhappy 的帖子
Error in ==> G_P at 29plot(ln_r(m,:),ln_C(m,:));
我调试了一下还是这样的,求大牛帮忙! function C_I=correlation_integral(X,M,r)
有一点小问题,
需要把sita=heaviside(r,d), 改成sita=heaviside(r-d);
就可以运行了 什么国外的源代码 上当 先看看程序能否运行 ??? Undefined function or variable "ln_r".
Error in ==> G_P at 36
plot(ln_r(m,:),ln_C(m,:));
这个错误该怎样修改? 回复 25 # zhenxing2000 的帖子
常见的程序出错问题整理 (eight), 3F
http://forum.vibunion.com/forum/thread-46001-1-1.html matlab官网找了一个heaviside的程序
function H=heaviside(z)
% Heaviside step function (smoothed version)
% Copyright (c) 2009,
% Yue Wu @ ECE Department, Tufts University
% All Rights Reserved
Epsilon=10^(-5);
H=zeros(size(z,1),size(z,2));
idx1=find(z>Epsilon);
idx2=find(z<Epsilon & z>-Epsilon);
H(idx1)=1;
for i=1:length(idx2)
H(idx2(i))=1/2*(1+z(idx2(i))/Epsilon+1/pi*sin(pi*z(idx2(i))/Epsilon));
end;
页:
1
[2]