Python - Shannon Hartley Theorem (Channel Capacity)
by matt392 in Circuits > Software
8 Views, 0 Favorites, 0 Comments
Python - Shannon Hartley Theorem (Channel Capacity)
# Shannon Hartley Theorem to compute Channel Capacity # Channel Capacity = (Channel Bandwidth * (log2(1 + (Signal Power/Noise)) ) import math print ("Shannon Hartley Theorem to compute Channel Capacity.") print ("The formula is: ") print ("Channel Capacity = (Channel Bandwidth * (log2(1 + (Signal Power/Noise)) )") # Input the data EnteredChannelBandwidth = input ("Enter the Channel Bandwidth: ") EnteredSignalPower = input ("Enter the Signal Power: ") EnteredNoise = input ("Enter the Noise: ") # Convert entered numbers to float ChannelBandwidth = float(EnteredChannelBandwidth) SignalPower = float(EnteredSignalPower) Noise = float(EnteredNoise) # >>>>>>> use math.log2() Log2Variable = (1 + (SignalPower/Noise) ) Log2Result = (math.log2(Log2Variable)) ChannelCapacity = ChannelBandwidth * Log2Result print ("The Channel Capacity is: ", ChannelCapacity)