From frequency-bin power to bits or nats
For retained nonnegative powers q(k), define p(k) = q(k) / Σq(j). The total must be positive and finite. Then H = -Σp(k) log₂ p(k) is in bits; replacing log₂ with ln gives nats. Define a zero-probability contribution as zero. For K retained bins, Hnorm = H / log₂(K), provided K > 1. Natural logarithms give the same normalized result when the denominator is ln(K).
- K counts every retained bin, including bins with zero power. Counting only occupied bins would change the normalization when a signal becomes concentrated.
- The bounds are 0 ≤ H ≤ log₂(K) and 0 ≤ Hnorm ≤ 1. Equality at 1 requires equal retained powers. The flat row is a mathematical reference, not an observed white-noise sample.
- The middle row is 0.867563 nats because Hnats = Hbits × ln(2). A common multiplicative power scale cancels when forming probabilities.
- These formulas use bin powers on a uniform frequency grid. With a density on unequal-width bands, first form band masses using their widths or numerical integration. Normalizing density heights alone answers a different question.
| Four-bin power vector | Probability vector | H in bits | Hnorm |
|---|---|---|---|
| [0, 32, 0, 0] | [0, 1, 0, 0] | 0 | 0 |
| [2, 8, 2, 0] | [1/6, 2/3, 1/6, 0] | 1.251629 | 0.625815 |
| [1, 1, 1, 1] | [1/4, 1/4, 1/4, 1/4] | 2 | 1 |