0
$\begingroup$

I am trying to calculate shannon entropy of CWT. I am not sure if I am doing it right. Assume that $W(a_i,t), i=1;2;...;M$ is a set of wavelet coefficients. The Shannon wavelet entropy is calculated by:
$E=-\sum_{i=1}^{M}d_i log(d_i)$ $\rightarrow$ where $d_i=\frac{|W(a_i,t)|}{\sum_{j=1}^{M}W(a_j,t)}$
I am confused how to calculate $E$. for example I have a coefficient matrix with size of $M\times N$, $M$ is scales number and $N$ is time segments. first I have to calulate $d_i$, this is my main problem. this is the wavelet coefficient matrix :
$W_{M\times N} = \begin{pmatrix} w_{a_1,1} & w_{a_1,2} & \cdots & w_{a_1,N} \\ w_{a_2,1} & w_{a_2,2} & \cdots & w_{a_2,N} \\ \vdots & \vdots & \ddots & \vdots \\ w_{a_M,1} & w_{a_M,2} & \cdots & w_{a_M,N} \end{pmatrix}$

hmm i am pretty sure i am wrong, can anyone help? for example tell me how can i calculate $d_4$?
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));
$\endgroup$
  • $\begingroup$ What paper did you get this from? $\endgroup$ – Aaron Dec 6 '13 at 16:38
  • $\begingroup$ from this paper: sciencedirect.com/science/article/pii/S0022460X05003913 actually the first 3 lines are from the paper, other lines are my question. $\endgroup$ – Electricman Dec 6 '13 at 17:32
  • $\begingroup$ also you can look here too: iitk.ac.in/nicee/wcee/article/14_05-01-0450.PDF @Aaron $\endgroup$ – Electricman Dec 6 '13 at 17:39
  • $\begingroup$ I don't understand why you would want to take the entropy of the wavelet. But if you did have a good reason for doing it I think your code is not pasted correctly. Why are there three end statements and only one loop? $\endgroup$ – Aaron Dec 27 '13 at 23:04
  • $\begingroup$ Hi @Aaron I want to find optimum pairs of $f_b,f_c$ for Morlet wavelet function. so if you look [here][1] you will see why I need to calculate shannon entropy.another paper explain the method more in [here][2] too. so that's why I need to calculate shannon entropy of wavelet. and you are right about two end. I will correct it, I would be glad if I understand how to calculate shannon entropy for CWT. your help is much appreciated [1]: iitk.ac.in/nicee/wcee/article/14_05-01-0450.PDF [2]: sciencedirect.com/science/article/pii/S0960148111000152 $\endgroup$ – Electricman Dec 28 '13 at 8:14
1
$\begingroup$

Yes. Your code does compute the same thing as the formula from the paper.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.