Sub topic 4
Decibels and Bode plots
This chapter assumes you can write a transfer function H(jω) as a complex ratio and find its magnitude and angle. It also assumes you are comfortable with base-10 logarithms. Here you will learn the unit and the plot that engineers use to show how a filter responds across many frequencies.
Why use decibels
A filter's gain can run from 1 down to 0.00001 across the frequencies you care about. On a linear axis, the small values all look like zero. A logarithmic unit spreads them out. It also turns the gains of cascaded stages from a product into a sum.
The decibel (dB) expresses a ratio on a log scale. For voltage ratios, which is what a transfer function gives you:
gain in dB = 20 · log10(|Vout / Vin|) = 20 · log10(|H(jω)|)
The factor is 20 for voltage (or current) and 10 for power. Power goes as the square of voltage, and log10(x²) = 2·log10(x), so both forms describe the same change.
Values worth memorizing
| Voltage ratio \ | H\ | Column | Gain in dB |
|---|---|---|---|
| 1 | 0 dB | ||
| 2 | +6.02 dB | ||
| 10 | +20 dB | ||
| 0.707 (1/√2) | -3.01 dB | ||
| 0.5 | -6.02 dB | ||
| 0.1 | -20 dB | ||
| 0.01 | -40 dB |
A negative dB value means attenuation. 0 dB means the signal passes at the same amplitude. The 0.707 entry is the one you will meet again in the next chapter, where it marks the cutoff frequency.
What a Bode plot shows
A Bode plot is a pair of graphs that share one horizontal axis.
- The top graph shows magnitude, 20·log10|H(jω)|, in dB.
- The bottom graph shows phase, the angle of H(jω), in degrees.
- The horizontal axis is frequency on a logarithmic scale.
The log frequency axis lets one plot cover 10 Hz to 100 kHz with equal room for each decade. A decade is a factor of 10 in frequency. An octave is a factor of 2. Slopes are quoted per decade or per octave, for example -20 dB/decade, which is about -6 dB/octave.
Computing the points
This script computes Bode data for the RC low-pass filter from the previous chapter. It uses two points per decade to show the pattern.
import numpy as np
R = 1.59e3 # ohms
C = 100e-9 # farads
f = np.array([100, 316.2, 1000, 3162, 10000, 100000]) # Hz
w = 2 * np.pi * f
H = 1 / (1 + 1j * w * R * C)
mag_db = 20 * np.log10(np.abs(H))
phase_deg = np.degrees(np.angle(H))
for fi, m, p in zip(f, mag_db, phase_deg):
print(f"{fi:9.1f} Hz {m:7.2f} dB {p:7.2f} deg")At 100 Hz the gain is close to 0 dB, because the capacitor barely loads the output. Around 1 kHz it is near -3 dB. Above that, each extra decade lowers the gain by about 20 dB. At 100 kHz the gain is near -40 dB, which is a voltage ratio of about 0.01.
Reading a plot
Follow these steps when you read a Bode plot:
- Find the flat region and note its dB level. This is the passband gain.
- Find the frequency where the curve is 3 dB below the passband level. This is the cutoff frequency.
- Measure the slope of the falling part in dB per decade.
- Read the phase at the same frequencies.
Exercise
A filter's output amplitude is 50 mV when its input amplitude is 1 V. What is its gain in dB, and what would it be one decade higher in frequency if the response falls at 20 dB/decade there?
Show answer
The ratio is 0.05, so gain = 20·log10(0.05) = -26.02 dB. One decade higher on a -20 dB/decade slope, the gain is about -46 dB, a ratio of about 0.005.