資源簡介
本代碼真實有效,可以運行,包括各種熵的matlab代碼,樣本熵、近似熵、模糊熵等等。

代碼片段和文件信息
function?[apen]?=?approx_entropy_bbd(nra)
%%?Code?for?computing?approximate?entropy?for?a?time?series:?Approximate
%?Entropy?is?a?measure?of?complexity.?It?quantifies?the?unpredictability?of
%?fluctuations?in?a?time?series
%?To?run?this?function-?type:?approx_entropy(‘window?length‘‘similarity?measure‘‘data?set‘)
%?i.e??approx_entropy(50.5a)
%?window?length=?length?of?the?window?which?should?be?considered?in?each?iteration
%?similarity?measure?=?measure?of?distance?between?the?elements
%?data?set?=?data?vector
%?small?values?of?apen?(approx?entropy)?means?data?is?predictable?whereas
%?higher?values?mean?that?data?is?unpredictable
%?concept?boorowed?from?http://www.physionet.org/physiotools/ApEn/
%?Author:?Avinash?Parnandi?parnandi@usc.edu?http://robotics.usc.edu/~parnandi/
data?=a;
for?m=n:n+1;?%?run?it?twice?with?window?size?differing?by?1
set?=?0;
count?=?0;
counter?=?0;
window_correlation?=?zeros(1(length(data)-m+1));
for?i=1:(length(data))-m+1
????current_window?=?data(i:i+m-1);?%?current?window?stores?the?sequence?to?be?compared?with?other?sequences
????%%??計算兩個之間的差超過多少的個數
????for?j=1:length(data)-m+1
????sliding_window?=?data(j:j+m-1);?%?get?a?window?for?comparision?with?the?current_window
????
????%?compare?two?windows?element?by?element
????%?can?also?use?some?kind?of?norm?measure;?that?will?perform?better
????for?k=1:m
????????if((abs(current_window(k)-sliding_window(k))>r)?&&?set?==?0)
????????????set?=?1;?%?i.e.?the?difference?between?the?two?sequence?is?greater?than?the?given?value??只要有兩個的距離大于r就置為1
????????end
????end%k=1:m
????if(set==0)?
?????????count?=?count+1;?%?this?measures?how?many?sliding_windows?are?similar?to?the?current_window
????end
????set?=?0;?%?reseting?‘set‘
????
????end%j=1:length(data)-m+1?end結束后得到所有落在模板i的r內的個數
???counter(i)=log(count/(length(data)-m+1));?%?we?need?the?number?of?similar?windows?for?every?cuurent_window
???count=0;
i;
end??%??for?i=1:(length(data))-m+1?ends?here
counter;??%?this?tells?how?many?similar?windows?are?present?for?each?window?of?length?m
%total_similar_windows?=?sum(counter);
%window_correlation?=?counter/(length(data)-m+1);
correlation(m-n+1)?=?((sum(counter))/(length(data)-m+1));
?end?%?for?m=n:n+1;?%?run?it?twice???
???correlation(1);
???correlation(2);
apen?=?correlation(1)-correlation(2);
%?apen?=?log(correlation(1)/correlation(2));
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????2417??2011-04-12?09:20??Entropy\approx_entropy_my.m
?????文件???????1737??2011-04-13?15:20??Entropy\Fuzzy_entropy_my.m
?????文件???????2019??2011-04-13?11:19??Entropy\Sample_entropy_my.m
?????文件???????1735??2017-12-14?11:43??Entropy\模糊熵.m
?????文件???????2610??2017-12-15?13:29??Entropy\相對熵.m
?????目錄??????????0??2018-05-04?10:31??Entropy
-----------?---------??----------?-----??----
????????????????10518????????????????????6
- 上一篇:變分模態分解matlab
- 下一篇:基于DS證據理論的信息融合代碼
評論
共有 條評論