Decibels and log scales
About this lesson
Signals span huge ranges: a microphone gives millivolts, a speaker needs volts. Decibels compare two sizes as a ratio on a logarithmic scale, so big and small numbers sit side by side and gains along a chain simply add. Follow a 10 mV signal through a preamp (×100), a volume control (×0.5) and a power amp (×10): +40, −6.02 and +20 dB add to 53.98 dB, a gain of 500. You will meet 10·log₁₀ for power, 20·log₁₀ for voltage, the absolute levels dBV and dBm, and do it all in Python with numpy. The Circuits lesson on transfer functions and Bode plots uses these scales next.
Tiny to large
A microphone gives a tiny 10 mV signal. To drive a speaker we need 5 V: 500 times bigger. Signals span huge ranges like this, so engineers compare them as ratios, measured in decibels (dB).
microphone 10 mV = 0.01 V speaker 5 V ratio 5 / 0.01 = 500 mV = millivolt = 0.001 V voltages here are rms values (the steady "heating" value of a wave)
Read the lesson step by step
Tiny to large
A microphone gives a tiny 10 mV signal. To drive a speaker we need 5 V: 500 times bigger. Signals span huge ranges like this, so engineers compare them as ratios, measured in decibels (dB).
microphone 10 mV = 0.01 V speaker 5 V ratio 5 / 0.01 = 500 mV = millivolt = 0.001 V voltages here are rms values (the steady "heating" value of a wave)A decibel compares two powers
A decibel compares two powers: dB = 10·log₁₀(P₂/P₁). Ten times the power is +10 dB, a hundred times is +20 dB, double is +3.01 dB, half is −3.01 dB. Equal powers give 0 dB.
dB = 10·log10(P2 / P1) log10(x) asks: 10 to what power is x? log10(10) = 1, log10(100) = 2 ratio dB ×100 +20 ×10 +10 ×2 +3.01 ×1 0 ×0.5 −3.01 bel = log10 of a power ratio; a decibel is a tenth of a belVoltage ratios use 20·log
Power grows with voltage squared: P = V²/R. So for voltages across the same resistance, dB = 20·log₁₀(V₂/V₁). Ten times the voltage is a hundred times the power: +20 dB either way.
P = V² / R P2/P1 = (V2/V1)² (same R) 10·log10((V2/V1)²) = 20·log10(V2/V1) voltage ×10 -> power ×100 -> +20 dB voltage ×2 -> power ×4 -> +6.02 dB voltage ×0.5 -> power ×0.25 -> −6.02 dBPreamp: ×100 is +40 dB
The preamp multiplies the voltage by 100: 10 mV becomes 1 V. In decibels its gain is 20·log₁₀(100) = +40 dB. Watch the level climb on both plots below.
in 10 mV gain ×100 out 1 V gain in dB = 20·log10(100) = 20 × 2 = +40 dBVolume: ×0.5 is −6.02 dB
The volume control halves the voltage: 1 V becomes 0.5 V. A ratio below 1 has a negative logarithm: 20·log₁₀(0.5) = −6.02 dB. In decibels, a loss is just a negative gain.
in 1 V gain ×0.5 (two equal resistors: a voltage divider) out 0.5 V 20·log10(0.5) = −6.02 dB ratio > 1 -> dB > 0 (gain) ratio = 1 -> 0 dB ratio < 1 -> dB < 0 (loss)Power amp: ×10 is +20 dB
The power amp multiplies by 10: 0.5 V becomes 5 V, a gain of +20 dB. On the volts plot the early steps vanish near zero. On the decibel plot every step is easy to see.
in 0.5 V gain ×10 out 5 V 20·log10(10) = +20 dB volts plot: 10 mV is 0.2 % of 5 V, flat against the axis dB plot: −40 .. +14 dBV, all clearMultiply gains, add decibels
Gains multiply: 100 × 0.5 × 10 = 500. Logarithms turn multiplying into adding: 40 − 6.02 + 20 = 53.98 dB. Check: 20·log₁₀(500) = 53.98 dB. Same answer, using only addition.
log(a·b) = log(a) + log(b) gains 100 × 0.5 × 10 = 500 in dB 40 + (−6.02) + 20 = 53.98 dB 20·log10(500) = 53.98 dB ✓ adding dB is how engineers budget a whole chain in their headdBV and dBm: absolute levels
With a fixed reference, dB gives an absolute level. dBV means compared with 1 V: 10 mV is −40 dBV, 5 V is +13.98 dBV. Into 8 Ω, 5 V gives 3.125 W, which is +34.95 dBm (re 1 mW).
dBV = 20·log10(V / 1 V) 10 mV -> 20·log10(0.01) = −40 dBV 5 V -> 20·log10(5) = +13.98 dBV dBm = 10·log10(P / 1 mW) P = V²/R = 5² / 8 = 3.125 W = 3125 mW 10·log10(3125) = +34.95 dBm (1 W = +30 dBm)Equal steps, equal ratios
The meter reads in dB and the right plot uses a log scale. Equal steps mean equal ratios: every 20 dB is ×10 in voltage, every 6.02 dB is ×2. Bode plots also use a log frequency axis.
dBV axis voltage +20 10 V 0 1 V −20 0.1 V −40 10 mV equal distance = equal ratio one decade (×10) = 20 dB of voltage filters and Bode plots: see Circuits, "Transfer functions and Bode plots"Decibels in Python
In Python with numpy, np.log10 works on a whole array: one line turns the three gains into decibels. Their sum and 20·log₁₀ of the product both give 53.98 dB.
import numpy as np g = np.array([100, 0.5, 10]) db = 20*np.log10(g) db.sum(), 20*np.log10(g.prod()) >>> db.round(2) array([40. , -6.02, 20. ]) >>> db.sum(), 20*np.log10(g.prod()) (np.float64(53.979400086720375), np.float64(53.979400086720375)) >>> (10**(db.sum()/20)).round() np.float64(500.0) (Python 3 with numpy)
5 quick questions
Choose one answer per question. You can change your choices before checking them.
01An amplifier makes the power 1000 times bigger. What is its gain in decibels?
For power, dB = 10·log₁₀(1000) = 10 × 3 = +30 dB.
02A cable halves the voltage of a signal (same resistance at both ends). What is its gain in dB?
For voltage, dB = 20·log₁₀(0.5) = −6.02 dB. Halving the voltage quarters the power, and 10·log₁₀(0.25) is the same −6.02 dB.
03Three blocks in a row have gains of +12 dB, −3 dB and +21 dB. What is the gain of the whole chain?
Decibels of blocks in a chain add: 12 − 3 + 21 = +30 dB. Adding dB is the same as multiplying the ratios.
04A signal is +20 dBV. What is its voltage?
dBV is relative to 1 V: 20·log₁₀(V / 1 V) = 20 means V = 10^(20/20) = 10 V.
05On a log-scale axis, what do equal distances stand for?
On a log axis each equal step multiplies by the same factor, for example one decade (×10) per step, which is 20 dB of voltage.
Glossary
- Ratio
- How many times bigger one quantity is than another: output ÷ input.
- Logarithm (log₁₀)
- The power you raise 10 to in order to get a number: log₁₀(100) = 2. It turns multiplying into adding.
- Decibel (dB)
- A tenth of a bel. For powers, 10·log₁₀(P₂/P₁); for voltages across the same resistance, 20·log₁₀(V₂/V₁).
- Gain
- The ratio of a block's output to its input, often given in dB. A negative gain in dB is a loss.
- dBV
- A voltage level compared with 1 V: 20·log₁₀(V / 1 V). 10 mV is −40 dBV.
- dBm
- A power level compared with 1 mW: 10·log₁₀(P / 1 mW). 1 W is +30 dBm.
- Log scale
- An axis where equal distances stand for equal ratios, such as one decade (×10) per step.
- rms voltage
- The root-mean-square value of a wave: the steady voltage that would heat a resistor equally.
Notes and sources
- The 10 mV microphone level is a chosen example; every other number is computed from it in this model. Voltages are rms values.
- Strictly, 20·log₁₀ of a voltage ratio equals the power ratio in dB only when both voltages are across equal resistances. Engineers still quote a block's voltage gain in dB this way, and so does this lesson.
- A real speaker's impedance changes with frequency; here it is treated as a plain 8 Ω resistor so that P = V²/R holds.
- A. V. Oppenheim, A. S. Willsky, S. H. Nawab, Signals and Systems, 2nd ed., Pearson (§6.2.3: log-magnitude in decibels and Bode plots)
- B. P. Lathi, R. A. Green, Linear Systems and Signals, 3rd ed., Oxford University Press, 2018 (Internet Archive record)
- A. V. Oppenheim, R. W. Schafer, J. R. Buck, Discrete-Time Signal Processing (course text listed on MIT OCW 6.341 readings)
- MIT OpenCourseWare 6.003 Signals and Systems (D. Freeman, Fall 2011): frequency responses
- Decibel (Wikipedia): 10·log₁₀ for power, 20·log₁₀ for root-power quantities, dBV and dBm references, the bel
- dBm (Wikipedia): power relative to 1 mW; 1 W = 30 dBm
- Logarithmic scale (Wikipedia): equally spaced values are equal ratios
- NumPy documentation: numpy.log10 (element-wise base-10 logarithm)
Quiz Unlocks after the last step.