This circuit will take an input signal and output its highest peak (until the capacitor dies out, so within reason.)
This circuit will take an input signal and output its highest peak (until the capacitor dies out, so within reason.) The diode only allows a positive voltage through it, so it will restrict any drop in voltage from affecting the capacitor. The capacitor in turn will take in any increase in voltage and hold it - but because no decrease in voltage will reach it, it will theoretically never disharge. In practice, it'll start to drop due to current leakage, but that's negligible (especially with a large enough capacitor or a fast enough signal.)
Discussion add comment