Figure below shows a positive peak detector circuit. As we can see, it is essentially a clipper circuit with a parallel resistor–capacitor connected at its output. The clipper circuit reproduces the positive half cycles. During this period, the diode is forward-biased. The capacitor rapidly charges to the positive peak from the output of the opamp through the ON resistance of the forward-biased diode.
As the input starts decreasing beyond the peak, the diode gets reverse-biased. This isolates the capacitor from the output of the opamp. The capacitor can now discharge only through the resistor (R) connected across it which is chosen to be much larger than the forward-biased diode’s ON resistance. The purpose of this resistor is to allow a discharge path so that the output can respond to decreasing amplitudes of the signal peaks.
The buffer circuit connected in front of the parallel resistor–capacitor prevents any discharge of the capacitor due to loading effects of the following circuit.
Positive peak detector circuit