Electronic – LTspice gives wrong AC analysis


I have multiple issues with LTspice. Take this trivial example:

XU1 N002 N001 vcc 0 N001 N003 ADA4807
V1 vcc 0 5
V2 N002 0 PULSE(0 1 0 0 0 0.5m 1m) AC 1
R1 N003 vcc 1k
C1 out 0 1p
R2 out N001 1
;tran 2m
.ac dec 1 100 1000Meg
.lib ADI.lib

Enter image description here

tran works fine:

Enter image description here

But ac gives me bogus results – like -47 dB "gain":

Enter image description here

Best Answer

As mentioned by just about everyone in the comments, your op amp doesn't work because your DC bias point is 0V and the op amp will only work for inputs between its rails (0V and 5V).

Your options are either: 1) Use positive and negative op amp rails, or 2) Bias the input AC voltage to between the two rails, e.g. 2.5VDC.

As seen below, with the DC bias point set at 0, I get similar broken behavior (although its a bit different since I used a different op amp)

enter image description here

If I add a 2.5V DC offset to the AC input, I get the expected behavior:

enter image description here

EDIT: See also The Photon's answer describing why the minimum output voltage limits you in this case.