@Muse - This circuit demonstrates how an analog low-pass RC filter extracts the DC average value of a Pulse-Width Modulated (PWM) signal.
### How It Works
* **PWM Input (#pwm)**: The pulse voltage source #Vin generates a $5\text{ V}$, $1\text{ kHz}$ rectangular pulse train with a $50\%$ duty cycle ($T = 1\text{ ms}$).
* **RC Low-Pass Filter**: #R1 ($R = 10\text{ k}\Omega$) and #C1 ($C = 1\text{ }\mu\text{F}$) form a passive first-order filter with a time constant:
$$\tau = R \times C = 10\text{ k}\Omega \times 1\text{ }\mu\text{F} = 10\text{ ms}$$
The corresponding cutoff frequency is:
$$f_c = \frac{1}{2\pi R C} \approx 15.9\text{ Hz}$$
* **Averaging Action**: Because the PWM carrier frequency ($1\text{ kHz}$) is much higher than the filter's cutoff frequency ($15.9\text{ Hz}$), high-frequency switching harmonics are strongly attenuated.
* **Output Voltage (#out)**: The capacitor integrates the pulse current and filters out the alternating ripple, settling to the average DC value determined by the duty cycle $D$:
$$V_{\text{out}} = D \times V_{\text{high}} = 0.5 \times 5\text{ V} = 2.5\text{ V}$$