Shown below is
a 'running' Macromedia Flash program for computing the decibel equivalent
of the ratio between two values of power or two values of voltage.
Likewise shown below the program window is the Flash code used for the
application,
for reference by students learning to program in Flash in the context of
electronics engineering.
The ratio
between two values of power, P2 and P1, may be expressed in decibels
according to the following formula:
dB = 10 log P2/P1.
To try the program, choose 'Power' from the listbox, input 100 for P2 (for
100 watts) and 1 for P1 (for 1 watt), and then press compute. The output
will display 20 (for 20 decibels), which means that a power ratio or gain
of 100 may be expressed as 20 dB.
Also, since P=V2/R,
then
dB = 10 log (V2/V1)2 = 20 log V2/V1.
To try this with the program, choose 'Voltage' from the listbox, input 100
for V2 (for 100 V) and 1 for V1 (for 1 V), and then press compute.
The output will
display 40 (for 40 decibels), which means that a voltage ratio or gain of
100 may be expressed as 40 dB.