Frequency Response and Transfer Functions
A sensor amplifier passes a slow temperature signal perfectly but turns a 3 kHz vibration into a weaker, delayed copy. An audio cable sounds fine with one amplifier and dull with another. Both effects have the same cause: circuits with capacitors and inductors treat each frequency differently. Instead of solving the circuit again for every frequency, we solve it once with left as a variable. The result, the transfer function , tells you the gain and the phase shift at every frequency. This lesson defines it, computes it for a small network, and shows how to read and measure it. The signal-processing view of the same idea is in Frequency Response of the Fourier course.
The idea: one sine in, the same sine out
In a linear circuit driven by a sinusoid, after the transient has died away every voltage and current is a sinusoid of the same frequency (Sinusoids and Phasors). Only two things can change between input and output: the amplitude and the phase. So for each frequency the circuit is described by two numbers, and as a phasor ratio by one complex number:
If , then in steady state
is the magnitude response (gain), the phase response. A ratio of two voltages is dimensionless; a ratio of voltage to current would be an impedance and is also a transfer function, just with units of ohms.
Computing the transfer function from the circuit
Replace every element by its impedance, , , (Impedance and Admittance), and solve the circuit as if it were resistive, keeping as a symbol. For the lag network above, in parallel with is
and the divider gives
with the DC gain and the pole frequency . Two features hold for many circuits:
- Limits first. At the capacitor is open: . At it is a short across the output: . Checking these two limits catches most algebra mistakes.
- The time constant seen by the capacitor sets the corner. The capacitor sees (the Thevenin resistance at its terminals with the source zeroed), so the corner is , the same rule as for first-order transients.
Magnitude and phase separately:
At the gain is (3 dB below its DC value, see Decibels and Bode Plots) and the phase is .
Worked example
Given: , , input peak.
Find: the DC gain, the pole frequency, and the output amplitude and phase at and .
Solve:
So a peak sine at comes out as peak, lagging by (a time delay of ); at as peak, lagging .
Check: both magnitudes are below the DC value and fall with frequency, as a capacitor across the output should make them; the phase lies between and , the range of a single pole.
In Python: evaluate H, then confirm in the time domain
The first part evaluates the formula. The second part drives the circuit's differential equation with a sine using scipy.signal.lsim, waits for the transient to die out, and measures the output amplitude: the same number, reached without phasors.
import numpy as np
from scipy import signal
R1 = R2 = 10e3; C1 = 10e-9
K = R2 / (R1 + R2)
tau = (R1 * R2 / (R1 + R2)) * C1
fp = 1 / (2 * np.pi * tau)
print(f"K = {K:.3f}, f_p = {fp:.1f} Hz")
H = lambda f: K / (1 + 1j * 2 * np.pi * f * tau)
print(" f (Hz) |H| dB phase (deg)")
for f in [100, 1e3, fp, 1e4, 1e5]:
h = H(f)
print(f"{f:9.0f} {abs(h):.4f} {20*np.log10(abs(h)):7.2f} {np.degrees(np.angle(h)):9.2f}")
# time domain: H(s) = K / (1 + s*tau), driven by a 1 V, 10 kHz sine for 2 ms
sys = signal.lti([K], [tau, 1])
t = np.linspace(0, 2e-3, 20001)
_, y, _ = signal.lsim(sys, np.sin(2 * np.pi * 1e4 * t), t)
print(f"lsim steady-state amplitude at 10 kHz: {float(y[t > 1e-3].max()):.3f} V")K = 0.500, f_p = 3183.1 Hz
f (Hz) |H| dB phase (deg)
100 0.4998 -6.02 -1.80
1000 0.4770 -6.43 -17.44
3183 0.3536 -9.03 -45.00
10000 0.1517 -16.38 -72.34
100000 0.0159 -35.97 -88.18
lsim steady-state amplitude at 10 kHz: 0.152 V
The time-domain run agrees with to three digits. That is the whole point of the phasor method: the steady-state answer without solving a differential equation.
Interactive: sweep the frequency
The netlist lab solves the network with phasors at the frequency on the slider and also plots against frequency.
At the lab shows at , as in the worked example. Make ten times larger and the whole curve shifts one decade down in frequency.
Guided lab: measure a frequency response point by point
Hand calculation. The table above: at low frequency, and at , and at for peak in.
Simulation. The Python table and the lab.
What you would measure. Build the network with 1 % resistors and a 5 % C0G/NP0 capacitor. Drive it from a function generator at peak-to-peak, channel 1 of an oscilloscope on the input, channel 2 on the output. At each of 100 Hz, 300 Hz, 1 kHz, 3 kHz, 10 kHz, 30 kHz and 100 kHz record the peak-to-peak ratio and the time shift between zero crossings; phase . Measure the input at the circuit, not the generator's setting, because the generator's output resistance drops part of the voltage. Expect the ratios within about (scope vertical accuracy) and the corner, where the ratio is 0.354 and the phase , between about and because of the capacitor's 5 % tolerance. A 10× probe (, about ) barely loads this network; a 1× probe adds around to and moves the corner down by roughly 1 %.
Hazards and safe setup. Signal-level voltages only; the generator and the scope share their earth through the mains leads, so connect both ground clips to the circuit's ground and nowhere else.
Pitfalls
- Frequency in Hz versus rad/s. . A formula with fed a value in Hz puts the corner off by a factor of 6.28.
- Forgetting "steady state". says nothing about the first few time constants after a signal starts.
- Ignoring the source and load. belongs to the circuit with its actual source resistance and load; connecting a different load changes it (First-Order Filters shows by how much).
- Phase wrapping.
np.anglereturns to ; a phase that keeps falling past wraps around. Usenp.unwrapfor plots.
Practice
- For the lag network, find the frequency where .
- Swap to sit across instead of . What are at DC and at very high frequency?
- A transfer function is . Give its output for an input .
Answer
- gives , so .
- At DC the capacitor is open: . At high frequency it shorts : . The network now raises the high frequencies (a lead network).
- At : . Output .
Test yourself
A linear circuit is driven by a 2 kHz sine. In steady state the output is…
- a sine at 2 kHz with a different amplitude and phase
- a sine at 4 kHz
- a square wave
- a decaying exponential
For , what is the phase at ?
In the lag network, which resistance sets the pole frequency together with ?
and at 10 kHz. An input of peak gives an output that…
- is peak and lags the input by
- is peak and leads by
- is peak
- is DC