This takes an ideal switched voltage input ( no rise or fall time) and uses a DRC (diode, resistive, capacitive) circuit to condition the voltage waveform to something closer to DC with slight ripple.
This circuit is representative.
The resistor could be external, or modelled as input resistance to an IC.
The capacitor value could be increased for a slower discharge of Vout (orange waveform).
Increasing capacitance also has the effect of mitigating voltage ripple.