I am trying to calculate shannon entropy of CWT
. I am not sure if I am doing it right. Assume that W(ai,t),i=1;2;...;M is a set of wavelet coefficients. The Shannon wavelet entropy is calculated by:
E=−∑Mi=1dilog(di) → where di=|W(ai,t)|∑Mj=1W(aj,t)
I am confused how to calculate E. for example I have a coefficient matrix with size of M×N, M is scales number and N is time segments. first I have to calulate di, this is my main problem. this is the wavelet coefficient matrix :
WM×N=(wa1,1wa1,2⋯wa1,Nwa2,1wa2,2⋯wa2,N⋮⋮⋱⋮waM,1waM,2⋯waM,N)
hmm i am pretty sure i am wrong, can anyone help? for example tell me how can i calculate d4?
Here I have right a little Matlab script to calculate shannon entropy of CWT.
Is it right or wrong? and what should I do?
[M,N]=size(coeffs);
for js=1:M
Ej(js)=sum(abs(coeffs(js,:)));
end;
Etot=sum(Ej);
Pj=Ej./Etot;
%shannon entropy
shan_entr=-sum(Pj.*log(Pj));
Answer
Yes. Your code does compute the same thing as the formula from the paper.
No comments:
Post a Comment