Function File: avgbits = laverage (codebook, problist)
Compute the average word length
SUM(
i= 1:
N)* Li * Pi
where codebook is a struct of strings, where each string represents the codeword. Problist is the probability values. For examplex = {"0","111","1110"}; p=[0.1 0.5 0.4]; laverage(x, p) ⇒ ans = 3.2000