求一个近似熵快速算法的matlab程序

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/23 22:31:50
求一个近似熵快速算法的matlab程序求一个近似熵快速算法的matlab程序求一个近似熵快速算法的matlab程序快速近似熵算法:function[ApEn_value,Cmr,Cmr_1]=fast

求一个近似熵快速算法的matlab程序
求一个近似熵快速算法的matlab程序

求一个近似熵快速算法的matlab程序
快速近似熵算法:
function [ApEn_value,Cmr,Cmr_1] = fast_ApEn(signal,r_factor)
% Estimate the Aproximate Entropy (ApEn) of a signal, using a fast % algorithm, for the ApEn parameter "m" equal to 2
% The pattern length "m" for which this routine was implemented is 2. For another values of "m", the instructions marked with a (*) in the end must be changed.% m=1 or m=2
% r between 0.1*STD and 0.25*STD, where STD is the signal standard deviation % N (signal length) between 75 and 5000;
% [ApEn_value] = fast_ApEn(signal,r_factor);% Input variables:% signal - signal% r_factor - factor of the criterion of similarity r_factor*std(signal)% Output variables:
% ApEn_value - ApEn calculated from the signal
% Optional output variables:% C_m% C_m_1
% if length(signal)5000
% slength=input('Signal length inappropriate. Continue anyway? (y/n)','s');% if strcmpi(slength,'y')==0% return% end% end
% if r_factor0.25
% r_factor_flag=input('Value for r parameter is inappropriate. Continue anyway? (y/n)','s');
% if strcmpi(r_factor_flag,'y')==0% return
% end% end% Initial variables definition.
signal=signal(:);
N=length(signal);
Cmr_ij=[];Cmr_i=[];Cmr=[];
Cmr_ij_1=[];Cmr_i_1=[];Cmr_1=[];
% D and S matrixes computation.
D=abs(signal*ones(1,N)-ones(N,1)*signal');
S=zeros(N,N);S(find(D