# Difference : LTspice AC analysis and frequency analysis in time domain

To do a frequency response analysis in LTspice, you can inject signals at various frequencies, and then use the measure and plot statement to view the results.

How is this different from doing a AC analysis around the DC-point of your system?

Basically: I am asking what is the difference between time-domain frequency analysis and “normal” frequency analysis in LTspice? When can you use which one?

This link gives an example of the time-domain frequency.

I feel that this has something to do with the linearity of the system.

• Yes - you are right to put the "normal" frequency analysis in quotation marks...can you explain what do you mean?
– LvW
Apr 1, 2020 at 16:46

I am asking what is the difference between time-domain frequency analysis and “normal” frequency analysis in LTspice?

LTspice is nothing but a SPICE solver, so .AC, or .TRAN, are the same as in every other SPICE program, with the sole differences being in the way the solvers, themselves, are implemented under the hood.

An .AC analysis relies on solving the circuit for an operating point, after which it is solved considering its response to a small signal, using complex values.

If the circuit is linear (e.g. RLC) then it does not need any special considerents -- the inductances are shorted, the capacitances opened, and the whole circuit is treated as a resistive network, which gives its operating point. Any small signal analysis is known to be accurate since the circuit will respond the same whether the input signal is 1 mV or 1 kV.

But if the circuit is nonlinear (e.g. a diode) then the analysis is done on a small slope around the operating point, because having a larger signal would cause nonlinear distortions.

To give an example, in the top graph, the blue trace shows the characteristic curve of a 1N4148. The red trace is (a hammered) slope representing the slope for the operating point at 700 mV. The small signal is approximated to be ~1 mV, because it is considered that its amplitude will, largely, not be affected by the nonlinearity of the system. That is, around the operating point, the characteristic curve can be considered a slope -- linear.

The dynamic resistance of the diode is plotted at the bottom, and the value at 700 mV is shown to be 238.06 Ω. Now, if you were to perform an .AC analysis for the same circuit, while using various DC levels for the source (from 0 to 700 mV, in 100 mV increments), you would get this graph:

Notice that the output is not flat and also varies with the different levels of polarization. And, using the cursors to measure the value at 1 Hz (.AC can't use DC) you see -1.85498 dB, which is:

$$20\log_{10}\left(\dfrac{1000}{1000+238.06317}\right)=-1.854856$$

Which is close enough given the truncation. This is why the .AC is called the small signal analysis: everything revolves around a small region on the operating point. Also, that operating point is considered to be the steady-state of the system.

A .TRAN analysis is done using real numbers and it may, or may not involve an operating point. This is because the signals can have any amplitude, so that the transient (.TRAN) effects can be studied in time domain. While you can perform an .AC in .TRAN, it is prone to numeric precision due to the limited numeric precision of the .raw file (by default it's in float; it needs .opt numdgt=7 to be double) and that of the waveform compression (can be disabled with .opt plotwinsize=0). It's also polluted with nonlinearities, since it's highly unlikely that the analysis will be done with small levels, 1 mV or below. Not lastly, it is tedious, because not only you need to run a frequency-swept signal, you need to wait for all the transients to die out so that you are in the steady-state, and detecting that is, again, affected by the limited numerical precision that .TRAN uses.

This is why .TRAN is known as the large signal analysis.

With these in mind, ...

When can you use which one?

If you are interested in the small signal frequency response of the system -- that is, you know that the system is, or is very close to being linear for the given signals, then .AC is for you. As per @The Photon's remark, you also have to consider that the system allows a frequency analysis (in LTspice, SMPSs can be analyzed, but it's not perfect; also see the rest of the answers in there).

If you are interested in the time domain response, that is, you want to see the nitty-gritty details of the transitory moments before the system settles, or how the signals are distorted (or not), then .TRAN is for you.

To use the same circuit as above, in .AC you get the graphs above, but in .TRAN, with the same 700 mV offset, a 10 MHz will yield one thing with a sine of 1 mV amplitude (bottom trace) versus 1 V amplitude (top):

If you do the math, for the 1 mV amplitude, 700 mV offset case, the output to input ratio can be calculated with these lines:

.meas avgo avg v(o)               ; output offset
.meas rmso rms v(o)-avgo          ; RMS without offset
.meas mag param rmso/(1m/sqrt(2)) ; magnitude of output/input
.meas db param 20*log10(mag)      ; dB(magnitude)
.meas to when v(o)-avgo=0 fall=4  ; "zero" crossing for output
.meas ti when v(i)-0.7=0 fall=4   ; "zero" crossing for input
.meas deg param rad*180/pi        ; phase difference, degrees


The 1m/sqrt(2) is the RMS of the input, withou the DC. The results are:

avgo: AVG(v(o))=0.190784 FROM 0 TO 4e-007
rmso: RMS(v(o)-avgo)=0.000644485 FROM 0 TO 4e-007
mag: rmso/(1m/sqrt(2))=0.911439
db: 20*log10(mag)=-0.805444
to: v(o)-avgo=0 AT 3.48408e-007
ti: v(i)-0.7=0 AT 3.5e-007


If you run an .AC at one single frequency, 10 MHz, as the signal, you get:

V(o):   mag:   0.915904 phase:    5.99033°


0.911439 ~ 0.915904 and 5.73095 ~ 5.99033, which is quite close. The same analysis is no longer possible for the 1 V amplitude -- that would be the large signal response and it involves nonlinearities.

Nonlinear distortions are .TRAN's speciality, frequency responses are .AC's.

As far as I can tell, what SPICE calls "AC analysis" is exactly what you described as "frequency response analysis".

But if you're specifically asking about switch mode supplies (which you used in your tags but never mentioned in your question text) the difficulty is that they aren't operated at a quiescent operating point with AC variation around that. A switch mode supply generates its output based on time averaging of a dynamically varying signal to produce a more-or-less steady output. Traditional SPICE AC analysis isn't able to simulate the time averaged response of this kind of system.

• That actually makes sense Apr 1, 2020 at 21:29