# Calculate Vout from an op amp

I have a op amplifier for which I want to calculate Vout depending on Vin.

The circuit looks like this: I know that with a circuit that just has ground connected to + of the amp, i can just calculate KVL: V1 = R1*I1+Rf*If+Vout but with this amp, there is also resistors on the plus side of the amp to include in the calculation. I know that I should consider the op to not let any curren through. Therefore I think that I can use KVL on the plus side as well, so that I get two KVL-equations.

My question is now, if I have V1 = R1*I1+Rf*If+Vout and V2=R2*I2+R3*I3, how do I put them together?

I think that I can assume I1=If and I2=I3, if that helps.

The answer to your question is very simple if you know the fundamental gain expressions for the inverting resp. non-inverting opam amplifier: G(inv)=-Rf/R1 and G(non)=1+Rf/R1. Note that the non-inverting gain G(non) is referenced to the non-inv. input terminal directly. Hence, we must - in addition - take into account the voltage divider R2-R3.

Because you have two input signals at the same time you simply can add both parts at the output (principle of superposition). Because all resistors are equal we arrive at the result:

Vout=G(non)V2[R3/(R2+R3)]-G(inv)V1=(1+Rf/R1)V2[R3/(R2+R3)]-V1(Rf/R1)=V2-V1

This circuit is a classic diff-amp. The output is V2-V1.

One way to analyze this circuit is to think of the affect from each input to the output separately. Start by grounding V2 and thinking about the response from V1 to the output. With V2 grounded, the + input is just held at 0. Now you have a simple inverting amp with a gain of -1 from V1 to Output.

Then ground V1 and see what changing V2 does. With V1 grounded, Rf and R1 form a voltage divider to make a classic positive gain amp from the + input to the output, with the gain being +2 in this case. Now note that the two resistors on the V2 input form a voltage divider with a gain of 1/2. That gain of 1/2 from the voltage divider times the gain of 2 for the amp make a overall gain of 1 from V2 to Output.

So you have a gain of -1 from V1 to Output and +1 from V2 to Output. Putting these together, you get the overall response of Output = V2 - V1.

For extra credit, figure out how to change the ratio of the resistors to make a diff amp with non-unity gain, like 4 for example.

This is a classic differential amplifier as pointed by Olin with output equal to $V_2-V_1$.

To analyse this the key points to remember are the current into the inverting and non-inverting inputs is negligible so assume zero and an op-amp with negative feedback will try to keep these inputs equal.

Output can be calculated as follows

$$\dfrac{\dfrac{V_1}{R_1}+\dfrac{V_{out}}{R_f}}{\dfrac{1}{R_1}+\dfrac{1}{R_f}}=\dfrac{\dfrac{V_2}{R_2}}{\dfrac{1}{R_2}+\dfrac{1}{R_3}}$$

Solving for $V_{out}$ which given all the resistors are the same value is simply $V_{out}=V_2-V_1.$

To explain the equation above the left hand side is the voltage at the inverting input and the right hand side the voltage at the non inverting input.

Consider a simple potential divider with voltages applied at both ends simulate this circuit – Schematic created using CircuitLab

\begin{align}\\ \dfrac{V_1-V_x}{R_1}+\dfrac{V_2-V_x}{R_2} & = 0\\ \dfrac{V_1}{R_1}+\dfrac{V_2}{R_2} & = \dfrac{V_x}{R_1} + \dfrac{V_x}{R_2}\\ V_x & =\dfrac{\dfrac{V_1}{R_1}+\dfrac{V_2}{R_2}}{\dfrac{1}{R_1}+\dfrac{1}{R_2}}\\ \end{align}

• I don't really get how you managed to get the equation above. Can you please explain that? – theva Nov 27 '14 at 21:11
• edited to explain – Warren Hill Nov 28 '14 at 7:41