# Why isn't the opamp negative input drives to 0?

I just get started to play around designing analog circuits after I have learnt something about it in my high school 20 years back, so forgive me if this question is dumb for you.

Here is my attempt to design an integrator - this is LTSpice, the opamp is ideal.

I am expecting the output to be the integral of the input. Here is my idea:

The negative feedback of the opamp should drive the negative input of the opamp to 0. (I learnt this rule in high school, but why? I am not sure)

With that in mind, the current from power source to Vout through R1 and C1 is:

$$\frac{V}{R_1} = I = C_1\frac{dV_{out}}{dt}$$

Rearranging, getting:

$$V_{out} = \int\frac{V_{in}dt}{R_1 C_1}$$

But here is the simulation result, something I don't expect, the negative input of the opamp is not exactly 0, it changes:

That is a small range of error, but for the opamp, it is sufficient to drive the output crazy.

1. How does opamp drive the negative input to match with the positive input, and
2. Why doesn't the negative input got drive to zero, and
3. What's wrong with my design?

• You were taught about basic op-amps in high school? No wonder China is progressing rapidly! – Spehro Pefhany Jan 4 '18 at 13:44

The LTspice opamp is not perfectly "ideal" — instead of infinite gain, it has a very large but finite gain. This is why the feedback doesn't drive the input to exactly zero. Given that the expected output swing is ±2V/2π = ±318 mV and you're measuring ±20 µV, that means that the actual opamp gain is:

$$A_0 = \frac{318\text{ mV}}{20\mu\text{V}} = 15915$$

But this shouldn't make the output go "crazy" — what exactly do you think is wrong with the output?

EDIT: It bothered me that your V(n001) is a sinewave with the same phase as the input, so I dug into it a bit further. I had expected to see a voltage that was a tiny fraction of the output voltage, which should be a cosine wave with an offset.

It turns out that the default LTspice opamp.sub model is a lot less ideal than I initially thought. It not only has a finite gain of 105, but it also has a finite GBW product, which is 10 MHz by default. Internally, it is modeled as a voltage-controlled current source, with a 1Ω resistor across the output (a Norton source) and also a capacitor across the output that sets the GBW product according to the formula

$$C = \frac{A_{ol}}{2\pi GBW}$$

This works out to 1.59 mF using the default parameters, giving a time constant of 1.59 ms and putting the pole at 100 Hz, as expected. But it is the output impedance of 1Ω in series with your 1F feedback capacitor that results in the reduced overall gain and the odd phase shift.

If you substitute an actual voltage-controlled voltage source for the opamp, with a gain of 105, you get the waveform that I was expecting to see.

For linear op-amp application the diff. voltage between both input terminals is always $V_{diff}=\frac{V_{out}}{A_{ol}}$, where $A_{ol}$ is open-loop gain.

As you can see, for $A_{ol}$ approaching infinity we have $V_{diff}=0$. As another example: For $V_{out}=1V$ and $A_{ol}=10^5$ we have $V_{diff}=10^{-5} V=10µV$.