# Confusion in precision rectifier

I want a to get a better understanding of precision amplifiers and their design. The book this diagram as an example of a precision amplifier:

The book says that "when v(input)=0 op amp raises Vy such that it barely turns on the diode."

I don't understand how this is possible because we know an ideal non-inverting amplifier has finite closed loop gain and if the input is zero then the output should also be zero (0×finite gain.)

1. How to justify that statement intuitively? (Better would be mathematically.)

2. If we remove R1 (in the figure) and replace it by a short circuit (figure below) what will be its output?

• Since you're not specifying that: in the mathematical model you're following, how does the I/V curve of the diode look like around 0? Commented Nov 18, 2020 at 12:10

You are confusing the output of circuit with output of opamp, they are not the same thing.

1. An ideal opamp output does whatever it needs in order to keep opamp input voltages equal via feedback.

So in this case the circuit Vout is same as opamp inverting input, and circuit Vin is opamp noninverting input. Thus Vout equal Vin, and opamp output is Vout+Vd.

1. It would be invalid circuit to short the resistance to ground. Inverting input and Vout would be ground because of the short. For any positive voltage Vin, the opamp output cannot set the inverting input no matter what, not even with infinite output current via diode to the ground shorted node.
• Thanks for answering ! similar question that I asked to Andy ,how even a slight+ve input is enough to produce op-amp output Vy=Vout +Vd ? Isn't there is also a possibility that Vy= (Vin×close loop gain )<(Vout+Vd) where we know (Vout =Vin ) and this condition violates the assumption that diode is in forward bias ? Commented Nov 18, 2020 at 20:04
• @user215805 I don't get what you are asking. Assuming ideal models for everything, if Vinout = Vnon-inv = 0, Vout = Vinv = 0 for any value of op-amp output below diode treshold, including minus infinity, so it's undefined condition. In real life, neither op-amps or diodes are ideal. Commented Nov 18, 2020 at 20:19
• ,I was asking why Vin positive always insured that diode will be in forward bias (assuming .7Vdrop model of diode) or in other words - let's assume diode is in forward bias (with .7V drop across it) and now we apply a Vin=1V so we get Vout also equal to 1V and (Vy=Vin×close loop gain ) so if let's say close loop gain is equal to 1.2 we get Vy= 1.2 ,so Vd=Vy -Vout =0.2 which is not equal to 0.7 and hence it violates our assumption that diode is in forward bias ,so where did I go wrong? Commented Nov 18, 2020 at 20:45
• @user215805 Well I don't know why you think closed loop gain would be 1.2. If Vin and Vout must be equal, say Vin=1V Vout=1V, current flows from opamp output via diode and resistor to GND, so Vy must be more positive than Vout, and that amount how much it must be positive is the Vd diode drop. Commented Nov 18, 2020 at 22:00
• @user215805 - " so we get Vout also equal to 1V and (Vy=Vin×close loop gain )". There's your problem. Vy = (V+ - V-) * Ag, where Ag is the open-loop gain. So, if the input is 1 volt, and the opamp output is Vin + Vd + a teeny tiny amount, then Vout will equal Vin. If it helps, don' t think of an op amp's gain as being actually infinite. Instead, think of it being, let's say, one million. Then the circuit will work if Vout is 1 microvolt less than Vin. Now consider that if the gain is increased, the allowable difference will approach zero. Commented Nov 19, 2020 at 0:31

In book it is written that "when v(input)=0 op amp raises Vy such that it barely turn on the diode" . But I don't understand how this is possible because we know for ideal non inverting amplifier has finite close loop gain and if input is zero then output should also be zero (0×finite gain)

Well, you're right, the ideal op-amp doesn't need to do anything at all because the input voltage is 0 volts and $$\V_{OUT}\$$ is set to be 0 volts by the pull-down resistor (R1) therefore, the op-amp has got no duty to perform and actually could be removed and the correct situation would still exist. Of course if the book you read has a different diagram then you may well be misapplying what you read.

But, if the input were (say) 2 volts, then the op-amp does have to perform a duty and that duty is: slightly turn on (aka slightly forward bias) the diode to push sufficient current through the pull-down resistor (R1) so that R1 develops 2 volts across it with respect to ground/0 volts.

• Thanks for answer !a doubt as you mentioned that if input were of 2V then diode will be in forward bias but isn't for diode to be forward bias (assuming .7V constant voltage drop model of diode) Vy >2.7 but what if closed loop gain is 1.2(assumption) then Vy=2.4 and hence it violates the forward bias condition Vy> 2.7 , I don't know what I'm missing ? Commented Nov 18, 2020 at 18:05
• Your circuit has a closed loop gain of unity. And, for this to be achieved, the op-amp output ($V_Y$) will be about 2.7 volts. $V_Y$ has got nothing to do with the closed loop gain. Yes, it happens to be the op-amp's output but, that's not the output of the circuit @user215805 Commented Nov 18, 2020 at 18:18

Sometimes it helps redrawing the circuit in a different way.

Let's start from the fact that the output is pulled down to ground, so vout is zero unless there is some good reason for it not to.

For vin<0, the op amp amplifies vplus-vminus and outputs a negative voltage (according to its amplification, it could reach its negative rail if there is enough negative input). The diode is inversely biased and does not pass any current (well apart from the usually negligible inverse saturation current) , so, vout stays pulled down at zero.

For vin>0, the op amp amplifies a positive difference vplus-vminus and outputs a positive voltage, and as current flows into the diode the output starts to rise from ground level. The op amp is under negative feedback and it pushes all the current required to make the voltage vminus to equal vplus, i.e. vin.

How does it do it? Well, if the current is not enough, vout is less than vin, so that vplus - vminus is positive and this voltage gets amplified, leading to more current being pushed out. If, on the other hand, too much current is being output, vout becomes greater than vin, so that vplus - vminus becomes negative and the output starts to go down and invert its polarity. But it won't go that far, because on its journey down, vout becomes less than vin and the tug o'war restarts. In the end, if vin>0 you reach an equilibrium when vout = vin, i.e. vplus = vminus. All of this is true forn an ideal op amp with infinite gain and infinite bandwidth.

Real op amp: finite gain and bandwidth, and offset voltage
If the gain is finite, the feedback mechanism is the same, but it is now necessary to have a bit of potential difference between the plus and minus inputs of the op amp in order to make the output voltage greater than zero. This differential voltage, if the gain is in the tens or hundreds of thousands, need to be just a handful of microvolts and is what makes the op amp perform its magic.
Things get a little bit more complicated due to other 'real world' characteristics of an op amp. In this particular case it worth remarking the effects of the offset voltage and bandwidth. The offset can be... offsetting when looking at the result of a simulation with a reasonably detailed model of a real op amp. It is educative to compare the differential inputs of the active rectifier with that of a simple follower, as shown here

For example, I used the model of an LF356 that has an offset of 3mV and with a ludicrously slow frequency of 10 Hz, this is a zoom of the simulation of the differential input vplus - vminus for the active rectifier (in green) and for the voltage follower (in red) - both have a sinusoidal input.

(Ignore the ringing and the fact I had let 1 second to pass before saving data to make sure I had no transients going on). As you can see, in order for a real op amp follower to... follow the input voltage the differential input vplus - vminus cannot be zero, but must vary sinusoidally with a peak to peak voltage of about 30uV (it would be zero in an ideal infnite gain op-amp), hanging from the offset voltage of 3mV. If I change the op amp model with an LF356A, the sinusoids would be hanging from -1mV. This is not just a quantitative difference: you would expect the sign of the differential input to mimick the sign of the input, but this is not the case.

Things get even weirder if we rise the frequency, because we soon meet the effect of the limited bandwidth of the op amp. This will not only change the amplitude of the differential input required to get the desired output, but it will also change dramatically the phase, and pretty soon you will find the vplus - vminus is shifted by practically 90 defrees from the desired output (when feedback is working). Here is the same simulation but at the higher (but seemingly reasonably slow) frequency of 1 kHz:

Notice that now the follower (in red) requires 400uVpp to follow the same sinusoidal input, and it's now almost centered around the 3mV offset voltage. But most striking is the change in phase with respect to the input.
So, if an op amp follower that would differ from an ideal device only by its finite gain would require a differential input in phase e of the same sign as the output it has to replicate, a real op amp would require an all-negative differential input almost in quadrature with the output is has to replicate. This behaviour is seen in the active rectifier, during the conduction phase.

Back to the rectifier
It is also educative to compare the voltage and current in the diode for an active and passive rectifier with real.world components, like this

Let's use the slow 10 Hz input to exclude bandwith shenaningans. Here are the input (blue) and output voltage for both circuits (passive rectifier in red, active rectifier in dark) from startup

and here are the voltage and current for the diodes starting from 1s after startup (still 150ms window). Notice that the diode voltage appears to be 0.25V immediately at the beginning of the cycle

So, the simulation - with real world components - appears to agree with Razavi.

Razavi's book is great but I cannot agree that "when v(input)=0 op amp raises Vy such that it barely turns on the diode." OP is right - if the op-amp is ideal, its output voltage will be zero when the input voltage is zero. The diode will be turned on only if the input voltage rises at least a little.

There is a lot of philosophy in this specific circuit that illustrates the unique property of negative feedback systems to overcome disturbances. It is not only a particular circuit phenomenon; it is a ubiquitous phenomenon that can be seen everywhere around us.

I have revealed this idea below in three consecutive steps to show its evolution. Prerequisite to understand what the op amp does in such a negative feedback circuit is to think of it not as a fast-acting amplifier but as a slow-acting "being".

1. Undisturbed follower. First replace the diode by a piece of wire (i.e., connect the op-amp output directly to its inverting input) and apply an input voltage Vin = 1 V at the non-inverting input - Fig. 1. The op-amp senses the (positive) voltage difference between its inputs and begins increasing its output voltage (Y) until zeros the difference. It does this without any effort because there is no disturbance. As a result, the circuit output voltage Vout (here, the same as the op-amp output voltage) is always equal to the input voltage. This is the well-known circuit of an op-amp follower.

Fig. 1. Undisturbed follower

We all act this way in life - we set a goal and begin to realize it by constantly comparing what we have achieved with the goal. For example, in this way we maintain the level of our speech equal to some level through the acoustic feedback between our mouth and ears... and we do it effortlessly because there is nothing to hinder us.

2. Slightly disturbed follower. Now put the diode back in its place - Fig. 2. A current begins flowing from the op-amp output through the diode and resistor R1 to ground. The diode begins conducting (forward biased) and a disturbing voltage drop VF = 0.7 V appears across the diode. It is subtracted from the op-amp output voltage (Y)... so the circuit output voltage Vout drops to 0.3 V... and again a positive voltage difference appears between the op-amp inputs. The op-amp senses it and begins increasing its output voltage (Y) until reaches 1.7 V thus zeroing the difference. As a result, the circuit output voltage Vout is again equal to the input voltage. Thus, at the cost of additional "effort" (extra op-amp output voltage of 0.7 V), the op-amp overcomes the diode interference.

Fig. 2. Slightly disturbed follower

In life, if an obstacle stands in our way when we achieve our goal, we overcome it at the cost of extra effort. For example, in our "speech analogy", imagine we enter a building; so we have to put on our mask against Covid 19. Attenuation appears in the acoustic feedback path (the mask acts as the diode in the OP's circuit) and we unconsciously begin increasing the level of our voice to compensate for this disturbance. This costs us extra effort.

3. Highly disturbed follower. Now change the polarity of the input voltage Vin = -1 V. The op-amp output voltage becomes negative and the diode is cut off. The negative feedback is broken and the circuit output voltage Vout becomes zero. Now a negative voltage difference appears between the op-amp inputs. The op-amp senses it and begins changing its output voltage (Y) below ground with the hope that it will zero the difference. In an effort to do so, it drops its output voltage lower and lower... but the difference does not change... and the output voltage finally reaches the voltage V- of the negative supply rail.

Fig. 3. Highly disturbed follower

In life, when obstacles are too great, they become insurmountable... and we expend all our energy to overcome them... but fail. In our "speech analogy", imagine we enter the Covid ward of the hospital. We are afraid of the infection and put on another very thick mask. But it completely stops our voice and we do not hear our own voice (no acoustic feedback). We start talking louder and louder... and finally we begin screaming.

I suggest you visit the laboratory exercises of my students from group 64b and 66a where you will see other interesting experiments with this diode circuit.

If you still have a Flash player, you can also visit the Flash movie Strange Things can be Put into Feedback Loop that I dedicated to Tom Hayes and his Student Manual for the Art of Electronics. Click on the diode symbol in the library on the left.

• I'm trying to understand, how does it transition from a slightly disturbed follower to a highly disturbed follower whenever it senses the negative voltage. I mean the op-amps output voltage becomes negative, but so does Vout (perhaps, becomes even more negative) I can't figure out what's wrong with this. Commented Jan 22, 2021 at 10:00
• @Essam, Thanks for the attention to my answer. I was going to write an answer to your question but I was pretty busy finishing the semester. OK, let's begin considering the problem here. From my experience I have understood a simple though paradoxical truth: to really understand op-amp circuits with negative feedback, you have to think of the op-amp not as an amplifier but rather as an integrator (something slow-acting as a human being); if you think of it as a fast proportional device (Vout = K.Vin), you will never understand op-amp circuits because you will revolve in a vicious circle... Commented Jan 22, 2021 at 11:02
• @Essam ... So, the best way to understand what the op-amp does is to put yourself in its place. For example, conduct such a mental experiment - change the voltage of a variable voltage source VA (immitating the op-amp output) until the voltage Vout after the diode becomes equal to Vin (you can compare the voltages by connecting a sensitive voltmeter between them). Then let's explain, thinking in this intuitive way, what the op-amp does... (to be continued...) Commented Jan 22, 2021 at 11:36
• @Essam, Let's first consider the positive input half wave. The input voltage Vin begins increasing above zero. The op-amp "senses" this positive disbalance and since its job is to keep it zero, it begins increasing its output voltage VA. Until Vin < 0.7 V, the diode does not conduct and the voltage at the non-inverting input does not "move"; so, the op-amp continues increasing VA with its maximum rate of change. When Vin approaches 0.7 V, the diode begins conducting and V(+) begins "moving" up... until it becomes (almost) equal to V(-)... and the equilibrium is restored... Commented Jan 22, 2021 at 16:13
• @Essam, As you know, a voltage drop about 0.7 V is lost across the diode and the op-amp has to overcome this "small disturbance" by increasing its output voltage with additional 0.7 V. You can think of the diode as of a 0.7 V "battery" connected in series and contrary to VA. That is why, VA will be "lifted" with 0.7 V above Vin until the diode is forward biased... and, as a result, Vout = Vin... Commented Jan 22, 2021 at 20:35