How are positive and negative feedback of opamps so different? How to analyse a circuit where both are present?

In an opamp, feedback on the positive input places it in saturation mode and the output is of the same sign as V+ - V-; feedback on the negative input places it in "regulator mode" and ideally Vout is such that V+ = V-.

1. How does the opamp change its behaviour depending on the feedback? Is it part of a more general "behavioral law"? [Edit: Isn't it something in the lines of the voltage added increases the error instead of reducing it in the case of + feedback?]
2. How can we analyse circuits where both are present?

Whoever answers both at the same time in a coherent manner wins a pot of votes.

-
There is a theorem that describes a general method to analyze circuits with any kind of feedback, is it what you are looking for? –  Vladimir Cravero May 30 at 12:30
There is an OUTSTANDING explanation of basic op-amp operation on this site somewhere, I just can't find it. Some of the more veteran members of the site may link it here, so I'll just add this comment: Suffice to say that you're probably thinking of op-amps only in terms of their inputs trying to be equal. It's a bit more nuanced than that. –  scld May 30 at 12:31
Yes to both of you, I think general analysis methods rely on a sound understanding of the behaviour of opamps so I want to address both of these. –  Mister Mystère May 30 at 12:42
To answer the question, it is necessary to know what is connected to the pos. terminal: An ideal voltage or current source ? Some additional resistors? –  LvW May 30 at 12:57
@LvW, it actually isn't necessary since, typically, we assume the input is driven by a source. If a voltage source, then $v = v_S$. If a current source, then $i = i_S$. The result that $v = -iR$ or that $v_o = 2v$ is independent of these details. –  Alfred Centauri May 30 at 14:34

1. Op-amp always behaves as a differential amplifier and the behavior of circuit depends on the feedback network . If negative feedback dominates, the circuit works in linear region. Else if positive feedback dominates, then in saturation region.
2. I think the condition $V^+ = V^-$, the virtual short principle, is valid only when the negative feedback dominates. So if you are not sure that negative feedback dominates, consider op-amp as a differential amplifier. To analyze the circuit, find $V^+$ and $V^-$ in terms of $V_{in}$ and $V_{out}$. Then substitute in the following formula, $$V_{out} = A_v(V^+-V^-)$$ calculate $V_{out}/V_{in}$ and then apply the limit $A_v\rightarrow\infty$
3. Now, net feedback is negative if $V_{out}/V_{in}$ is finite. Else if $V_{out}/V_{in} \rightarrow \infty$, then the net feedback is positive.

Example:
From the circuit given in the question, $$V^+ = V_{in}\ \text{and}\ V^- = V_{out}/2$$ $$V_{out} = A_v(V_{in} - V_{out}/2)$$ $$\lim_{A_v\rightarrow\infty}\frac{V_{out}}{V_{in}} = \lim_{A_v\rightarrow\infty}\frac{A_v}{1+A_v/2} = 2$$ $$V_{out} = 2V_{in}$$ $V_{out}/V_{in}$ is finite and net feedback is negative.

$\mathrm{\underline{Non-ideal\ source:}}$
In the above analysis, $V_{in}$ is assumed to be an ideal voltage source. Considering the case when $V_{in}$ is not ideal and has an internal resistance $R_s$. $$V^+ = V_{out}+(V_{in}-V_{out})f_1\ \text{ and }\ V^- = V_{out}/2$$ where, $f_1 = \dfrac{R}{R+R_s}$ $$V_{out} = A_v(V_{out}/2+(V_{in}-V_{out})f_1)$$ $$V_{out}(1-A_v/2+A_vf_1) = A_vf_1V_{in}$$ $$\lim_{A_v\rightarrow\infty}\frac{V_{out}}{V_{in}} = \lim_{A_v\rightarrow\infty}\frac{f_1}{\frac{1}{A_v}-\frac{1}{2}+f_1}$$ $$\frac{V_{out}}{V_{in}} = \frac{f_1}{f_1-\frac{1}{2}}$$

case1: $R_s\rightarrow 0,\ f_1\rightarrow 1,\ V_{out}/V_{in}\rightarrow 2$

case2: $R_s\rightarrow R,\ f_1\rightarrow 0.5,\ V_{out}/V_{in}\rightarrow \infty$

$%case3: R_s \rightarrow \infty,\ f_1 \rightarrow 0,\ V_{out}/V_{in} \rightarrow 0$

The output is finite in case1 and so net feedback is negative in these conditions ($R_s < R$). But at $R_s = R$, negative feedback fails to dominate.

$\mathrm{\underline{Application:}}$
Case1 is the normal working of this circuit but it is not used as an amplifier with gain 2. If we connect this circuit as a load to any circuit, this circuit can act as a negative load (releases power instead of absorbing).

Continuing with the analysis, the current through $R$ (from in to out) is, $$I_{in}=\frac{V_{in}-V_{out}}{R}=\frac{-V_{in}}{R}$$ calculating the equivalent resistance $R_{eq}$ $$R_{eq} = \frac{V_{in}}{I_{in}} = -R$$

This circuit can act as negative impedance load or it act as a negative impedance converter.

-
Thanks for your answer. That's an interesting method which has the advantage of working every time as it's the exact formula of what the opamp is doing as far as I know. Could you analyse the aforementioned circuit with that method so that we can compare the results obtained with the other methods? –  Mister Mystère May 31 at 11:28
@MisterMystère There is no need to analyze the circuit in the question. Input-output relation is already given. But let me try... –  nidhin May 31 at 15:13
Honestly I took a random circuit from Google images to illustrate the question and serve as an example. I don't have a particular problem, this is for personal improvement. But seeing that others have developed their methods, I would like to compare them. –  Mister Mystère May 31 at 17:22
@MisterMystère Thank you and LvW for pointing out the errors. Case3 should be $V_{out}/V_{in}\rightarrow 0$. It does not go into saturation. Try simulating this. –  nidhin Jun 2 at 17:23
@MisterMystère and nidhin, the circuit nidhin has simulated and linked to for verification of case 3 has the op-amp 'upside down'; the op-amp input terminals are opposite that of the circuit above. The circuit simulated is stable for $R_S > R$ and unstable for $R_S < R$ which is precisely the opposite of the NIC circuit analyzed. The analysis above for case 3 is incorrect and the simulated circuit is not the circuit analyzed. i.stack.imgur.com/gcuEi.png –  Alfred Centauri Jun 3 at 13:24

How does the opamp change its behaviour depending on the feedback?

The ideal opamp behaviour itself is unchanged; it is the circuit's behaviour that is different.

Isn't it something in the lines of the voltage added increases the error instead of reducing it in the case of + feedback?]

That's correct as far as it goes. If we perturb (or disturb) the input voltage, negative feedback will act to attenuate the disturbance while positive feedback will act to amplify the disturbance.

How can we analyse circuits where both are present?

As usual, assume there is net negative feedback which implies that the non-inverting and inverting input voltages are equal. Then, check you result to see if, in fact, negative feedback exists.

I'll demonstrate by solving your example circuit.

Write, by inspection

$$v_+ = v_o + iR$$

$$v_- = v_o \frac{R_1}{R_1 + R_1} = \frac{v_o}{2}$$

Set these two voltage equal and solve

$$v_o + iR = \frac{v_o}{2} \rightarrow v_o = -2Ri$$

which implies

$$v_o = 2v_+ = 2v$$

This is a good thing because we expect that this is a non-inverting amplifier and indeed, we get a positive voltage gain. Interestingly, the input resistance is negative: $\frac{v}{i} = -R$.

However, if we add an additional resistor $R_S$ in series with the input, we can run into trouble.

In that case, the equation for the non-inverting input voltage becomes

$$v_+ = v_S \frac{R}{R_S + R} + v_o \frac{R_S}{R_S + R}$$

which implies

$$v_o = \frac{2R}{R - R_S}v_S$$

Note that when $R_S < R$, the voltage gain is positive as expected from a non-inverting amplifier.

However, when $R_S > R$, the voltage gain is negative for a non-inverting amplifier which is a red flag that something is wrong with our assumptions.

The wrong assumption is that there is negative feedback present and it was that assumption which licensed us to set the non-inverting and inverting input voltages equal in the analysis.

Note that the voltage gain goes to infinity as $R_S$ approaches $R$ from below. Indeed, there is no net feedback when $R_S = R$; the negative and positive feedbacks cancel. This is the 'boundary' between net negative feedback and net positive feedback.

Is this method of picking up on red flags always valid to determine the limit between net positive and negative feedback?

What I did, in this case, was to make an assumption, solve the circuit under that assumption, and check the solution for consistency with the assumption. This is a generally valid technique.

The assumption was, in this case, that net negative feedback is present which implies that the op-amp input terminal voltages are equal.

When we solved the circuit in the 2nd case, we found that the net negative feedback assumption is valid only when $R_S \lt R$. If $R_S \ge R$, there is no or positive feedback and, thus, no reason to constrain the input terminal voltages to be equal.

Now, it may not be clear why there is positive feedback when $R_S \gt R$. Recall the setup for deriving the negative feedback equation:

Here, we subtract a scaled version of the output voltage from the input voltage and feed this difference $V_{in} - \beta V_{out}$ to the input of the amplifier.

Clearly, this assumes $\beta$ is positive in order that there be a difference between the input and scaled output voltages.

The well known result is

$$V_{out} = \frac{A_{OL}}{1 + \beta A_{OL}} V_{in}$$

and, in the limit of infinite gain $A \rightarrow \infty$

$$V_{out} = \frac{1}{\beta}V_{in}$$

Comparing this equation with the result for the 2nd case above, see that

$$\beta = \frac{R - R_S}{2R}$$

from which it immediately follows that we have net negative feedback only when $R_S \lt R$.

There is some discussion in the comments about the conclusion for case 3, $R_S > R$, in the accepted answer. Indeed, the analysis for case 3 is not correct.

As shown above, if we assume the op-amp input terminal voltages are equal, we find a solution where

$$v_o = \frac{2R}{R - R_S} v_S$$

Now assume, for example, that $R_S = 2R$ then

$$v_o = -2v_S$$

And, in fact, one can verify that this is a solution where the op-amp input terminal voltages are equal

$$v_+ - v_- = 0$$

However, if we perturb the output slightly

$$v_o = -2v_S + \epsilon$$

The voltage across the op-amp input is perturbed to

$$v_+ - v_- = \frac{\epsilon}{6}$$

which is in the same 'direction' as the disturbance. Thus, this is not a stable solution since the system will 'run away' from the solution if disturbed.

Contrast this with the case that $R_S < R$. For example, let $R_S = \frac{R}{2}$. Then

$$v_o = 4v_S$$

Perturb the output

$$v_o = 4V_S + \epsilon$$

and find that the op-amp input voltage is perturbed to

$$v_+ - v_- = -\frac{\epsilon}{6}$$

This is in the opposite direction as the disturbance. Thus, this is a stable solution since the system will 'run back' to the solution if disturbed.

-
Thanks for the clear answer. Is this method of picking up on red flags always valid to determine the limit between net positive and negative feedback? Is the limit that brutal or is there a blurry limit? –  Mister Mystère May 31 at 11:24
@MisterMystère, see the addendum to my answer. –  Alfred Centauri May 31 at 18:25
Thanks again, that's really an excellent answer. It was really tough to decide which answer to accept, but I went for nidhin's mainly because he could use the reputation (that's a water drop in a lake for you). See you around on SE. –  Mister Mystère Jun 2 at 8:55
@MisterMystère: Are you aware that nidhin´s answer is NOT correct in all cases? He wrote:"The output is finite in cas1 and case3 so net feedback is negative in these conditions". Apparently, this is false for case 3. In this case, the circuit is unstable and the result "-2" is wrong. Instead, the opamp goes into saturation. –  LvW Jun 2 at 10:41

It's still useful to analyse this as a linear situation where you can assume that -Vin always equals +Vin. I'm going to redraw to show the input voltage going through a resistor because as the OP has shown it in his diagram "v" could be assumed to be a voltage source and therefore the effect of "R" is of no consequence: -

simulate this circuit – Schematic created using CircuitLab

$V_X = (V_{IN} - V_{OUT})(\dfrac{R2}{R1+R2})+ V_{OUT}$

And also: -

$V_X = V_{OUT}(\dfrac{R4}{R3+R4})$ (because the two op-amp inputs are the same i.e. still a linear analysis)

Equating the two formulas for $V_X$ we get: -

$V_{OUT}(\dfrac{R4}{R3+R4}) = (V_{IN} - V_{OUT})(\dfrac{R2}{R1+R2})+ V_{OUT}$

Rearranging we get: -

$V_{OUT}(-1 +\dfrac{R2}{R1+R2} +\dfrac{R4}{R3+R4})= V_{IN}(\dfrac{R2}{R1+R2})$

Sanity check - in the normal case when R2 is infinite the equation boils down to: -

$V_{OUT}(-1 +1 +\dfrac{R4}{R3+R4})= V_{IN}(1)$ and we see that: -

$\dfrac{V_{OUT}}{V_{IN}} = 1+\dfrac{R3}{R4}$ so that's OK and going back to the equation: -

$V_{OUT}(-1 +\dfrac{R2}{R1+R2} +\dfrac{R4}{R3+R4})= V_{IN}(\dfrac{R2}{R1+R2})$ we see that: -

$\dfrac{V_{OUT}}{V_{IN}} = \dfrac{-\dfrac{R2}{R1+R2}}{1-\dfrac{R2}{R1+R2}-\dfrac{R4}{R3+R4}}$

Clearly we approach a "problem" (i.e. infinite gain) when the denominator heads towards zero and this happens when: -

$\dfrac{R2}{R1+R2} + \dfrac{R4}{R3+R4} = 1$

So hopefully this makes sense. Normally, for linear operations the circuit gain is dependant on all four resistors but, if the ratios of the resistors are as above, the gain is infinite.

-
Yes - I agree to the above result. However, I would suggest to use another form of the result: Vout/Vin=+[R2/(R1+R2)]/[R4/(R3+R4)-R1/(R1+R2)]. This form allows a quick analysis of the circuit´s properties. The gain must be positive (the + input is energized) and the circuit is stable as long as the negative feedback dominates. Otherwise, the result would be negative which is inconsistent. The stability limit is for pos. feedback equal to neg.feedback . –  LvW May 30 at 14:19
@LvW I'm struggling with seeing your formula = the Vout/Vin I got dude –  Andy aka May 30 at 14:27
I must admit,I don`t understand the contents of your comment ("dude" ?) –  LvW May 30 at 14:41
@LvW dude is just a friendly name! I don't see how my formula can equal your formula! –  Andy aka May 30 at 14:58
Simply set: 1-[R2/(R1+R2)]=[R1/(R1+R2)]. –  LvW May 30 at 15:09

Because the question was: How to analyze? Here comes a way to analyze such a circuit which is relatively quick and easy:

From the classical feedback formula (H. Black) we know that for an idealized opamp with infinite open-loop gain the closed-loop gain is simply (see the circuit diagram with four resistors in one of the answers):

$$A_{cl} = -\frac{H_f}{H_r}$$

($H_f$: Forward damping factor; $H_r$: feedback factor.)

Both functions can be easily derived from the circuit:

$$H_f = \frac{R_2}{R_1+R_2}$$

and

$$H_r = \frac{R_1}{R_1+R_2} - \frac{R_4}{R_3+R_4}$$

Hence, the result is

$$A_{cl} = \dfrac{\dfrac{R_2}{R_1+R_2}}{\dfrac{R_4}{R_3+R_4}-\dfrac{R_1}{R_1+R_2}}$$

It is worth mentioning that the advantage of the circuit is the following: We can select a desired stability margin and/or use non-compensated opamps for lower gain values (data sheet: stable for gain>Acl, min only).

Justification: From the expressions above one can derive that it is possible to match the feedback factor to the corresponding open-loop gain (for a certain stability margin) - without restrictions to the closed-loop gain value. One can regard this method as a special kind of "external frequency compensation".

With other words: I can choose less feedback (good for stability) and - at the same time - a small value for closed-loop gain Acl.

-
Thanks for answering. I assume with this method you separate linear from saturated mode by Acl going very high, but how high? Could you explain more about how to get the Hf and Hr factors generally speaking (transfer function from Vo to Vin on both pads?)? –  Mister Mystère May 31 at 11:36
In my opinion, using the Hf and Hr factors is the most efficient way to analyse (complicated or involved) opamp circuits. Definitions are as follows: Hf is the portion of the input voltage that appears across the opamp input in case we set Vout=0. Accordingly, Hr is the portion of the output voltage that appears across the opamp input (V+ - V-) in case the input voltage is set to zero. This is simply an application of the superposition theorem. –  LvW Jun 1 at 8:27
Thanks for your very good answer; but I went for nidhin's answer which is more detailed and intuitive. You're right about the voltage source though, but as I said it was only an illustration example, I didn't know at that time anyone would actually try to solve it. Up to next time –  Mister Mystère Jun 2 at 8:58