Can someone explain how this switched circuit charges and discharges the capacitor?

The switched circuit is above. I am trying to understand how the switch causes the capacitor to charge and discharge. Most of the examples I can find involve using a switch to connect a capacitor to a voltage source, charging it up until the voltage across the capacitor equals the source. Then a switch is used to isolate the capacitor from the source, discharging the capacitor.

This circuit is much more complicated than that. Does closing the switch cause the current to bypass the capacitor, discharging it?

• When S1 is closed, it shorts the capacitor and it should discharge (not instantly though because it's discharging through a resistor R3). The voltage on R2 will also drop to zero. – Havenard Feb 6 '18 at 20:50
• can you explain the reason for the voltage divider? Why not just remove R2? – Stone Preston Feb 6 '18 at 21:00
• R2 sets the maximum voltage C can be charged to, with the switch open. Maximum voltage is equal to the ratio of R1/R2. – Sparky256 Feb 6 '18 at 23:00