LTSpice functionalities regarding its Frequency Domain Analysis

In summary, the conversation discusses the use of LTSpice for frequency domain analysis of circuits and the convenience of using an AC voltage source for small signal AC analysis and obtaining Bode plots. The user is curious about the specific AC voltage source used by LTSpice and if it can be changed to different waveforms. The conversation also mentions some helpful articles and suggests joining an LTSpice user group for further clarification.
  • #1
PhysicsTruth
117
18
TL;DR Summary
Working mechanisms of the LTSpice software regarding the frequency domain analysis of a circuit.
The time domain analysis is easier to plot compared to analyzing the frequency with respect to the phase. But, LTSpice makes it look really easy. So, for a small signal AC analysis, LTSpice does use a AC voltage source for its frequency domain analysis function. This must be a really convenient source of voltage. Is it the Sine waveform that the frequency function of LTSpice uses for its frequency analysis? Can we just use any other voltage source like a pulse or a FM wave, as are available in LTSpice for AC sweep? Do they actually work in every condition for the frequency analysis?

So, my basic area of interest is - does LTSpice have some specific AC voltage source, like a Sine Wave, or a random pulse (square, sawtooth), that it uses for its frequency analysis everytime we wish to obtain a Bode plot ? This would intrigue me further to read about the convenience of such a AC voltage source to be used for small signal AC analysis and its frequency plots.
 
Engineering news on Phys.org
  • #2
PhysicsTruth said:
Summary:: Working mechanisms of the LTSpice software regarding the frequency domain analysis of a circuit.

So, my basic area of interest is - does LTSpice have some specific AC voltage source, like a Sine Wave, or a random pulse (square, sawtooth), that it uses for its frequency analysis everytime we wish to obtain a Bode plot ?

Does this help?

https://www.analog.com/en/technical-articles/ltspice-ac-analysis-using-the-step-command.html
 
  • Like
Likes PhysicsTruth
  • #3
berkeman said:
I have gone through this article before and it's really interesting. Unfortunately, it doesn't speak about the frequency function in details. In order to perform the frequency analysis, I need a AC voltage source for sure. I want to know LTSpice's choice of such a voltage source, which makes their work so convenient.
 
  • #4
PhysicsTruth said:
I have gone through this article before and it's really interesting. Unfortunately, it doesn't speak about the frequency function in details. In order to perform the frequency analysis, I need a AC voltage source for sure. I want to know LTSpice's choice of such a voltage source, which makes their work so convenient.
Are you asking if LTSpice forces a sine wave even if you put in a different source?
 
  • Like
Likes PhysicsTruth
  • #5
Yes, I'm basically asking that.
Sine wave is the easiest to work with owing to the Fourier Transforms, but if I do wish to work with an exponential wave, does the sine wave still come into picture?
 
  • #6
PhysicsTruth said:
Yes, I'm basically asking that.
Sine wave is the easiest to work with owing to the Fourier Transforms, but if I do wish to work with an exponential wave, does the sine wave still come into picture?
I am not 100% certain but I believe I have looked at frequency analysis on step functions or pulses before. You can easily do simple experiments to see what it does and also you might ask that question in specific LTSpice user groups.
 
  • #7
Well, I've done analysis with other pulses as well, but the frequency analysis all look the same as it is with the sine wave.
 
  • #8
PhysicsTruth said:
Well, I've done analysis with other pulses as well, but the frequency analysis all look the same as it is with the sine wave.
Maybe I was thinking of Fourier analysis. Anyway, it sound like an expert use group question. Are you in a group?
 
  • #9
bob012345 said:
Maybe I was thinking of Fourier analysis. Anyway, it sound like an expert use group question. Are you in a group?
No, what's a group?
 
  • #10
PhysicsTruth said:
No, what's a group?
I meant an LTSpice user group which is an online community of LTSpice users you can join and ask other users questions. Here is one group. There are probably others. Usually it is free to join.

https://groups.io/g/LTspice
 
  • #12
bob012345 said:
Thanks a lot. I have gone through the last 2 articles before, I would like to go through the first one.
 
  • Like
Likes bob012345
  • #13
I have nothing useful to add about LTSpice.

But, if you are seeking "frequency response" or "Bode plots", those are only defined in terms of sinusoids. If you want to do a different transform, like wavelets, let's say, you need to explicitly say that. "Frequency response" implies you have a single frequency. You may very well want to know the response to square waves, for example, but no one will call that "frequency response".
 
  • #14
PhysicsTruth said:
I have gone through this article before and it's really interesting. Unfortunately, it doesn't speak about the frequency function in details. In order to perform the frequency analysis, I need a AC voltage source for sure. I want to know LTSpice's choice of such a voltage source, which makes their work so convenient.
SPICE doesn't use the SINE large signal in small signal - it uses the fact that with circuit analysis of a linear circuit, you can use Laplace forms for equivalent impedances so that: V = IR and V = I sL and V = I / sC. This means the small signal AC is just the same as a resistor linear algebra problem. Instantaneously anyway.

Then SPICE uses a numerical integrating solution over time to solve V = L dI/dt and I = C dV/dt explicitly to find the equivalent instantaneous reactance value. These are then treated as "resistances with phase" in terms of the matrix math.

The nasty bits of SPICE come when you insist on a nonlinear solution over time. In addition to the above integration of d/dt, there's also linearization of nonlinear components (like transistors or diodes) and then integration over time to simulate how nonlinear behavior changes with bias point (which is now changing constantly).

So to solve over time, SPICE may solve the same circuit over multiple delta t intervals of linearized reactance and linearized nonlinear components: easily you can have many dozens to hundreds of separate linear algebra resistive matrix solutions per time-point in a TRANsient simulation.

That's the only time the SINE function gets used (and of course by trig identities, SINE = COSINE with a phase shift so there's nothing special about it other than the SINE being a piece-wise interpolated time version). The forcing values are similarly dissected from evaluations of a math library sin/cos function per instantaneous solution at a given time point used in the numerical integration of nonlinear components.

The TRAN transient solvers are far more unstable and prone to "convergence" than the AC solvers so you want to use the latter as much as you can.

The small signal is a pure AC source "for sure" but it only works for linear circuits. As soon as you put a semiconductor in, you either must "linearize" the semiconductor at a specific bias point (Q point) and specific set of independent, non-interacting frequencies, and then treat the entire circuit as a linear component with no nonlinear features (no distortion, no multiplication/modulation/etc) OR you have to use a TRAN simulation which is entirely nonlinear and ONLY then can the SINE source be used.
 
  • Like
  • Informative
Likes alan123hk, PhysicsTruth and DaveE
  • #15
jsg2021 said:
SPICE doesn't use the SINE large signal in small signal - it uses the fact that with circuit analysis of a linear circuit, you can use Laplace forms for equivalent impedances so that: V = IR and V = I sL and V = I / sC. This means the small signal AC is just the same as a resistor linear algebra problem. Instantaneously anyway.
Your replies so far are good, thanks. Can you please post a link to supporting technical content? At PF we try to include a link to a technical site that supports what we are saying. I'm not saying that your reply is wrong, just giving gentle advice about how to optimize your posts on PF.

Thanks again. :smile:
 
  • #16
All implementations of SPICE operate in the same way. LTspice is no different.

The .TRANsient analysis is performed by numerically integrating the signals over time. Taking smaller time steps leads to more accurate results.

.AC analysis is performed by analysing the network in the frequency domain using Laplace etc.
The source for .AC analysis is a flat sinewave spectrum, from DC to daylight, with infinite resolution.
.AC does not consider time steps, DC operating point, nor discrete frequencies.

https://groups.io/g/LTspice
 
  • Like
Likes DaveE and bob012345
  • #17
Baluncore said:
All implementations of SPICE operate in the same way. LTspice is no different.
Sort of... there are apparently major architecture differences in the few implementations not based on spice3, namely ltspice and xyce. LTspice seems to be essentially a custom x86-only JIT architecture but has almost no interesting original features aside from maybe a bit better performance in large simulations (I don't think many people are doing extremely large analog simulation in LTspice.) I suppose they did do a pretty impressive job maintaining interoperability for a total from-scratch rewrite which is probably why people think it's yet another windows port of spice3.

To me LTspice is probably the least interesting of the bunch though... I only sometimes run it under wine for its crappy schematic capture tool (because the alternatives are even crappier).

Baluncore said:
The .TRANsient analysis is performed by numerically integrating the signals over time. Taking smaller time steps leads to more accurate results.
...Sort of. Indirectly. The fact that precision doesn't necessarily improve with timestep resolution is key to important optimizations - mainly determined by {rel,abs,vn}tol etc. You can set the max timestep to zero to run a transient simulation in the minimum number of steps with theoretically no loss in precision.
 
Last edited:
  • #18
jsg2021 said:
The small signal is a pure AC source "for sure" but it only works for linear circuits. As soon as you put a semiconductor in, you either must "linearize" the semiconductor at a specific bias point (Q point) and specific set of independent, non-interacting frequencies, and then treat the entire circuit as a linear component with no nonlinear features

Calculation example of AC impedance of nonlinear diode 1N4148 after linearization under different bias currents.

123.jpg


It is worth mentioning that, do not try to add complex logic statements (If-Then-Else) or components with memory effects to the circuit, which may cause the linearization calculation results to be uncertain or deviate from expectations.
 
Last edited:
  • Like
Likes iteratee
  • #19
Yeah that's interesting if the model specifies nonzero CJO since I'm pretty sure that models varactor effects. Though it's probably an ideal varactor with infinite SRF... looks like that's true up to 100mhz at least.
 
  • Like
Likes alan123hk

FAQ: LTSpice functionalities regarding its Frequency Domain Analysis

What is the purpose of frequency domain analysis in LTSpice?

Frequency domain analysis in LTSpice allows users to analyze the behavior of a circuit in the frequency domain, rather than the time domain. This is useful for understanding how a circuit responds to different frequencies and can help with designing and troubleshooting circuits.

How do I perform frequency domain analysis in LTSpice?

To perform frequency domain analysis in LTSpice, you can use the AC analysis feature. This can be accessed by clicking on the AC button in the toolbar or by typing ".ac" into the command line. From there, you can specify the frequency range and other parameters for the analysis.

Can LTSpice simulate non-linear circuits in the frequency domain?

Yes, LTSpice can simulate non-linear circuits in the frequency domain. However, it is important to note that some non-linear components may not behave as expected in the frequency domain, so it is always recommended to verify the results with a time domain simulation as well.

Is it possible to plot multiple signals in the frequency domain on the same graph in LTSpice?

Yes, it is possible to plot multiple signals in the frequency domain on the same graph in LTSpice. This can be done by adding multiple traces to the same plot using the ".plot" command or by using the right-click menu on the graph and selecting "Add Traces".

How can I export frequency domain analysis data from LTSpice?

To export frequency domain analysis data from LTSpice, you can use the ".meas" command to measure and save specific values at certain frequencies. You can also export the entire data set by right-clicking on the graph and selecting "Export Data".

Back
Top