complexity.m

来自「有用的几个动力学物理量。包括自相关函数(acorr.m)」· M 代码 · 共 38 行

M
38
字号
function cmp=complexity(x,n);% cmp = complexity(x,n);%% calculate the Lempel-Ziv complexity of the n-bit encoding of x. %% cmp is the normalised complexity, that is the number of distinct% symbol sequences in x, divided by the expected number of distinct % symbols for a noise sequence.%% Algorithm is implemented in complexitybs.c%% M. Small% ensmall@polyu.edu.hk% 7/10/04if nargin<2,    n=2;end;if length(n)>1,   for ni=1:length(n),        cmp(ni)=complexity(x,n(ni));    end;    else,    %do the binning, with equi-probably bins    x=x(:);    nx=length(x);    [xn,xi]=sort(x);    y=zeros(nx,1);    y=1:nx;    y=floor(y.*(n/(nx+1)));    x(xi)=y;    %compute complexity with complexitybs    cmp=complexitybs(x+eps);end;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?