All problems
Ergodic Capacity (Uniform Fading)
Problem
Return the ergodic capacity in bits of a channel whose SNR is uniform on [a, b]:
C = (f(b) - f(a)) / ((b - a) * ln(2)), f(x) = (1 + x) * ln(1 + x) - x
Assume b > a >= 0.
Hint
Averaging log2(1 + gamma) over the fading distribution gives the ergodic capacity.
Test cases
case 1
in: [0,1]
expected: 0.5573049591110365
case 2
in: [0,2]
expected: 0.934748710192771
case 3
in: [1,2]
expected: 1.3121924612745053
case 4
in: [0,4]
expected: 1.4597150777202395
Starter codePython
import math
def ergodic_capacity_uniform(a, b):
# Your code here
pass4 test cases · run your code against them in the editor