A single diode peak detector example. A small capacitance of 1nF is used. The output waveform steadily rises in small steps over many periods of the input waveform. You can also see that the capacitor's charge oscillates during each period, due to the diode's reverse leakage current.