近似熵程序clearallx=load('are.dat')n=length(x)sd=std(x)r=0.2*sdforii=1:2m=ii+1;num=zeros(n-m+1,1);fori=1:n-m+1forj=1:n-m+1ifj~=ifork=1:md(k)=abs(x(i+k-1)-x(j+k-1));endd1=max(d);ifd1rnum(i,1)=num(i,1)+1;endendendc0(i)=num(i,1)/(n-m);c1(i)=log(c0(i));endsc=sum(c1);fi(ii)=sc/(n-m+1);endapp=fi(1)-fi(2);end