Inverting OpAmp with reference voltage

amplifierfeedbackoperational-amplifier

Can anyone please explain how to calculate Vout for both cases below?

1 case, simulation shows Vout is -1V
2 case, simulation shows Vout is +2V!

I understand how things work when there is a virtual ground, but when there is a reference voltage applied and resistor on the feedback, I can not get the logic where -1V and +2V came from.

enter image description here
enter image description here

Best Answer

In the negative feedback configuration, the op amp will drive its output such that the voltage between its positive and negative inputs is (ideally) zero. In the first example, the positive input is at 3V. Therefore the op amp will drive the negative input to 3V. So R1 will have 2V across it, and therefore 2mA through it; this 2mA all flows through R2 (no current flows into input because an ideal op amp has infinite input impedance), so there is 4V drop across R2. Therefore the output is 3V - 4V = -1V. Apply the same reasoning in the second example.

You can solve for the output voltage symbolically by summing the currents at the negative input:

$$ \frac{V_3-V_4}{R_1} + \frac{V_{out}-V_4}{R_2} = 0 $$