资源简介
该程序用于计算信号复合多尺度排列熵,matlab环境下程序
代码片段和文件信息
%复合多处度排列熵(CMPE)
function E=CMPE(iSigmts)
% iSig: input signal; m : embedded dimension; % s: scale number
for i=1:s
E_change=zeros(1i);
for j=1:i
iSig_change=iSig(j:end);oSig=CoarseGrain(iSig_changei);E_change(j)=PE(oSigmt);
end
E(i)=mean(E_change);
end
%多尺度排列熵(MPE)
function E=MPE(iSigmts)
% iSig: input signal; m : embedded dimension; % s: scale number
for i=1:1:s %i : scale index
oSig=CoarseGrain(iSigi); E(i)=PE(oSigmt);
end
%Coarse Grain Procedure. See Equation (11) % iSig: input signal ; s : scale numbers ; oSig: output
function oSig=CoarseGrain(iSigs)
N=length(iSig); %length of input signal
for i=1:1:N/s
oSig(i)=mean(iSig((i-1)*s+1:i*s));
end
function E=PE(sigmt) %默认延迟时间为t
N=length(sig); %length of signal
v=[1:m]; % m=3 v=[1 2 3]; m=5 v=[1 2 3 4 5]
all_pemu=perms(v); % generate all possible permutations
perm_num=factorial(m); % calculate m! to obtain the number of all possible permutations
for i=1:1:perm_num
key(i)=genkey(all_pemu(i:)); %transform a vector into an integer; ex: [4 3 1 2] ==> 4321
end
pdf=zeros(1perm_num); %initialize frequency array
for i=1:1:N-t*(m-1)
pattern=sig(i:t:i+t*(m-1)); % obtain pattern vector from signal.
[Yorder]=sort(pattern); % sort the pattern vector; order represents the permutation order.
pkey=genkey(order); %transform the order vector into an integer.
id=find(key==pkey); pdf(id)=pdf(id)+1;
end
pdf=pdf/(N-t*(m-1)); % normalize the frequency array to obtain probability density function.
%cal
评论
共有 条评论