entropy estimation using histogram of normal data vs direct formula (matlab)
问题 Let's assume we have drawn n=10000 samples of the standard normal distribution. Now I want to calculate its entropy using histograms to calculate the probabilities. 1) calculate probabilities (for example using matlab) [p,x] = hist(samples,binnumbers); area = (x(2)-x(1))*sum(p); p = p/area; (binnumbers is determined due to some rule) 2) estimate entropy H = -sum(p.*log2(p)) which gives 58.6488 Now when i use the direct formula to calculate the entropy of normal data H = 0.5*log2(2*pi*exp(1))