title: Usage of entropy function
body: <p>I was trying to find the entropy of a certain probability distribution in MATLAB. For p, I tried doing</p>
  
  <pre><code>E = -sum(p .* log2(p))
  </code></pre>
  
  <p>and <code>Echeck = entropy(p)</code></p>
  
  <p>Shouldn't E and Echeck be same?     </p>
  
  <p>The matlab help on entropy does say Entropy is defined as -sum(p.*log2(p))
  where p contains the histogram counts returned from imhist.But also that entropy converts any class other than logical to uint8 for the histogram count calculation since it is actually trying to calculate the entropy of a grayscale image and hence wants the pixel values to be discrete.
  So I guess it's incorrect to use this function for my purpose?
  Is there a good alternative?</p>