# How does this circuit act as a half wave rectifier?

I'm having trouble to understand how this circuit operates exactly. The op amp is an LM339 from ST (datasheet link).

The circuit in question is as follows:

The op amp should be a comparator, but the circuit apparently also works with regular op amps. The supply voltage range goes from VDD = 10 V to VSS = GND.

From my understanding the op amp tries to set the voltage at its output pin (V_Out1) in such a way that the inverting input equals the non-inverting input. The inverting input, which also equals V_Out2, outputs the half rectified input signal, though. Maybe I still don't understand negative feedback correctly...

Also I'm quite confused by my simulation results. The picture of the circuit was generated via falstad.com/circuit applet. There if I input an input voltage with 10 Hz then V_Out2 = V_In+. But if I simulate it in LTSpice V_Out2 will always be a half rectified signal (see picture below).

Up until around 30 kHz. Then it starts to look like usual capacitor discharge at the end of a half cycle (see picture below).

Basically my question is: Why and how does it work like that? And which simulation can I trust? I would assume LTSpice.

BIG EDIT BECAUSE I WAS STUPID

So I was using an incorrect op amp in my simulation with LTSpice. Because I used the wrong one, I chose to remove an apparently small but integral part of the circuit, because it seemed to work (eventhogh I didn't know why).

Below is the updated circuit diagram. Please ignore the 50kHz input, because I did an updated run with the correct op amp in LTSpice.

The updated outputs are in the picture below. The simulation was run with a 500Hz input.

The following picture provides the output without the added 100k resistor and 3.3V supply.

Now I totally get the half rectified input. The questions I have now are:

• Why does the circuit only work with the added 100k resistor and +3.3V supply?
• Somehow the frequency for which the circuit works got heavily reduced. Why?
• What supply voltages is your simulator applying to the op-amp power pins? An op-amp can (at best) pull the output down to the negative supply rail or up to the positive supply rail. If the negative supply rail is GND (0 V) then the output can't go lower than that. Try a split-rail power supply - say +12 V, -12 V. Jan 20, 2022 at 23:09
• @Transistor thanks for the hint. I will edit my question :) But its VDD = 10V, VSS = GND Jan 20, 2022 at 23:10
• Comparators have open collector , you would see this in the datasheet. So it must have some pullup. It's not a very good design unless you told us it was for AGC and you expect it to track the minimum voltage not the peak for a very high f. No design can be properly analyzed without expectations or SPECS Jan 21, 2022 at 0:09
• I deleted my answer due to my misunderstanding of what you want to know., Jan 21, 2022 at 0:25
• All right. Thank you for your help so far. In my opinion (as far as the circuit diagrams show) its "only" a half wave rectifier. The output will be fed into a lp-filter, then an adc. For understanding what the comparator does: At the base of the output transistor will be applied a current such that the collector current, which in turn produces a voltage drop over the 100k and 100 resistors, will set the voltage between the 100k and 100 ohm. This voltage will then be the same as the voltage at the non-inverting input. Is that right? Jan 21, 2022 at 0:32