Python - Signal Attenuation

by matt392 in Circuits > Software

11 Views, 0 Favorites, 0 Comments

Python - Signal Attenuation

sigattenformula.png
# Signal Attenuation/Reduction of Signal Strength
# Signal Attenuation = 10 * log10(Input Power\Output Power)
import math

print ("Signal Attenuation in decibels.")

print ("The formula is: ")
print ("Signal Attenuation = 10 * log10(Input Power\Output Power)")

#  Input the data
EnteredInputPower = input ("Enter the Input Power: ")
EnteredOutputPower = input ("Enter the Output Power: ")

# Convert entered numbers to float
InputPower = float(EnteredInputPower)
OutputPower = float(EnteredOutputPower)

# Signal Attenuation = 10 * log10(Input Power\Output Power)
# math.log10()
SignalAttenutation = 10 * (math.log10(InputPower/OutputPower))

print ("The Signal Attenuation in dB is: ", SignalAttenutation)