title: Spectral Entropy and Spectral Energy of a vector in Matlab
body: <p>I am going to use Spectral Energy and Spectral Entropy as features for window-based time-series data. However, I'm bit confused about the formula being used for it online, especially about the the special Entropy. </p>
  
  <p>I used entropy from Matlab but that doesn't work with time-series data. It just give me zero for everything. <a href="http://www.mathworks.nl/help/images/ref/entropy.html" rel="nofollow noreferrer">http://www.mathworks.nl/help/images/ref/entropy.html</a>
  Test window Entropy result for this version = 0</p>
  
  <p>Then I used this version.
  <a href="http://www.mathworks.com/matlabcentral/fileexchange/28692-entropy" rel="nofollow noreferrer">http://www.mathworks.com/matlabcentral/fileexchange/28692-entropy</a>
  Test window Entropy result for this version =  4.3219</p>
  
  <p>I also tried the -sum(p.*log2(p)) after applying imhist to a data window ( p = imhist(aw1(:));). Got this from an online help.<br>
  Test window Entropy result for this version = 0.0369</p>
  
  <p>All of them reported different values. </p>
  
  <p>For spectral energy, I am using the squared sum of fft coefficients. 
  sum(abs(fft(data-window)).^2)</p>
  
  <p>Can any body give me any suggestion which is the correct version ? </p>