I have an input signal like this.
I wish to display the highest voltage for a period of time with LED. So I need to retain the highest voltage until the next new highest voltage comes. I tried D flip flop, but being a digital component, it makes everything 0 or 1. But in my (analog) case, say, the 1st highest voltage is 5V, the next could be 7V, and I need to preserve the values! In addition, if the next peak is 4V (<5V), I need to latch 4V.
So what is the simplest possible analog way of latching the highest voltage until a new peak (possible lower or higher) comes?
I think, the type of a circuit that you are looking for is called peak detector.
The simplest peak detector consists of a diode and a capacitor. The diode prevents the capacitor from discharging, so it retains the max voltage less the diode drop. The diode drop is a shortcoming of a simple circuit like this. It doesn't "see" voltages that are less than the diode drop.
(That page where this snippet came from is worth skimming through.)
An OpAmp peak detector is more precise. It compensates for the diode voltage drop.
( source )
There is a fair amount of information about peak detectors: EEVblog video, Planet Analog article.