S2 · Lesson 37 · Noise and distortion lab
Integrated noise, noise figure, harmonics and intercepts, in Python
Noise sets the smallest signal a circuit can handle and distortion sets the largest, and between them lies its dynamic range. The formulas for both are first-order approximations: flicker noise integrated over a band, the noise figure from a source, harmonics from a power series, and the bipolar pair's third harmonic. This lab computes each exactly in Python, including a discrete Fourier transform of a real tanh pair's output, and measures how far the approximations hold.
- The curves are a bipolar differential pair's third-harmonic distortion against input amplitude: the series approximation and the exact result from the tanh characteristic.
- They agree closely at a few millivolts and part as the amplitude grows: the next term of the series has the opposite sign, so the exact HD3 falls slightly below the approximation.
- The lab computes the exact curve with a Fourier transform.
Predict
A bipolar pair is driven with 10 mV peak. What does the series approximation give for HD3, and is the exact value higher or lower?
. The lab's Fourier transform of gives 0.309%, 0.9% lower: the series is excellent at small amplitudes and drifts as they grow (3.6% low at 20 mV).
Name it
The tools
- Integrated noise: with white density and flicker corner , the rms noise from to is .
- Harmonics from a power series for : and .
- Third-order intercept (input amplitude): .
- Exact harmonics: sample one period of the output at N points and take the DFT magnitudes at bins 1 and 3.
Check
Write integrated_noise(ew, fc, f1, f2): rms noise voltage over the band.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Write harmonics(a1, a2, a3, A): return (HD2, HD3) from the power-series approximations, and iip3(a1, a3): the input amplitude at the third-order intercept.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Write pair_hd3(v_mv, N=4096): the exact HD3 of a bipolar pair, the ratio of the third to the first DFT magnitude of over one period (k = 0..N−1, = 25.85 mV).
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Write dynamic_range(noise_rms, a1, a3, hd3_max): the largest amplitude whose HD3 (from the series) stays under hd3_max, divided by the rms noise, returned in dB; amplitudes are peak, so convert to rms by .
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Explain why
Why does the series approximation for a bipolar pair's third harmonic overestimate the exact value at larger amplitudes?
The approximation keeps only the first nonlinear term of the tanh's Taylor series, the cubic, which makes the third harmonic grow as the square of the amplitude. The next term, the fifth-order one, has the opposite sign, and it also contributes to the third harmonic, in proportion to the amplitude to the fourth power. At small amplitudes that contribution is negligible, but as the drive grows it subtracts a growing amount, so the exact third harmonic falls below the quadratic prediction. At a few millivolts the two agree to under a percent; at 20 mV the gap is several percent.