RC Low-Pass Filter
Frequency Response
So far we've analyzed DC circuits (constant voltages). Real signals have frequency content — they oscillate. Different frequencies pass through a circuit differently.
The RC Low-Pass Filter
Vin ---[R]---+--- Vout
|
[C]
|
GND
The capacitor's impedance is Xc = 1/(jωC), where ω = 2πf. At low frequencies, Xc is large → Vout ≈ Vin. At high frequencies, Xc is small → Vout ≈ 0.
Voltage Gain (Magnitude)
|H(f)| = 1 / sqrt(1 + (2πfRC)²)
Or equivalently using ω = 2πf:
|H| = 1 / sqrt(1 + (ωRC)²)
The Cutoff Frequency
At f_c = 1/(2πRC), gain = 1/√2 ≈ 0.7071 — the −3 dB point. This is where power is halved.
| f | |H| | Meaning | |---|-----|---------| | 0 | 1.0000 | DC passes through | | f_c | 0.7071 | −3 dB (half power) | | 10·f_c | 0.0995 | mostly blocked | | 100·f_c | 0.0100 | almost completely blocked |
Applications
- Audio: remove high-frequency hiss
- ADC anti-aliasing: remove frequencies above Nyquist
- Power supply: smooth rectified AC into near-DC
- Signal smoothing / averaging
Your Task
Implement double rc_lowpass(double f, double r, double c) that returns the voltage gain magnitude |H(f)|.
Use #include <math.h> for sqrt and define PI.