Home
Login / Signup
 di 

Performing AC Analysis in LTspice

plot.png

LTspice is capable of performing several types of simulations. Probably the most used type is the transient simulation, which allows the designer to appreciate the time response of his circuit. Another type of simulation, which reveals the frequency response of the circuit under scrutiny is the AC simulation or analysis.

While transient simulation is suitable for both linear and non-linear circuits, it only makes sense to perform AC analysis on linear circuits. The reason for this is that LTspice and other spice simulators use the small-signal linear models of all components in order to perform AC simulation. Since the number of purely linear circuits is really big (most circuits involving inductors, capacitors and diodes only) it makes sense to have a look on how to perform such a useful analysis with LTspice.


The small signal (linear) AC portion of LTspice computes the AC complex node voltages as a function of frequency. First, the DC operating point of the circuit is found. Next, linearized small signal models for all of the nonlinear devices in the circuit are found for this operating point. Finally, using independent voltage and current sources as the driving signal, the resultant linearized circuit is solved in the frequency domain over the specified range of frequencies.
This mode of analysis is useful for filters, networks, stability analyses, and noise considerations.


The level of detail in which this article is written assumes the reader has already gone through the previous article which represented the first LTspice tutorial on this website:

LTspice - the free and complete SPICE simulator


and that he is familiar with the basics of the user interface detailed there.


Basic RC low pass filter

We will simulate and visualize the frequency response of a basic RC filter. In order to do this, launch LTSpice and draw the circuit below:

 

 

Figure 1 – Basic RC filter


One element that was not mentioned in the previous article regarding LTspice was the net label. In the above schematic, two net labels are being used, one called “Input” and the other one called “Output”. What the net label does is to assign a known and non-default name to the net to which it is attached. By default, LTspice uses names like n001, n002, n003 etc. for the nets in the schematic in some order which has no particular meaning for the man who draws the schematic. However, using net labels, you may choose the name for the nets, which makes it easier when you plot the waveforms, as you can find the nodes of interest easier.
In order to place a net label, you need to use the correct button available on the top toolbar of the user interface:


 

 

Figure 2 – Net label


In order to perform AC simulation, one of the voltage sources has to be prepared in advanced for this. After placing the regular voltage source in the schematic, right/click on it, and in the window that pops up, enter a value of 5V in the “AC Amplitude” textbox:

 

 

Figure 3 – Prepare voltage source for AC simulation

Once you have successfully drawn the new schematic, open the “Edit Simulation Command” window (from the top menu select Simulate->Edit Simulation Cmd) and select the “AC Analysis” tab. Several options are available here. First you need to select the type of sweep, which in most cases of basic circuit simulation is decadal. You then must enter of number of computation points for each decade (from 1kHz to 10kHz there is a decade, from 10kHz to 100kHz there is another decade, from 10kHz to 100kHz there is another decade and so on). The value you enter in this textbox will have a direct impact on the duration of your simulation (the higher the number of computation points, the longer the simulation will take). Since this is a very simple circuit, there is no need to worry about how long the simulation will last (it will be short anyway) and you can enter a big number there (for instance 1000 points per decade). You then need to choose the start frequency and the stop frequency, these being the limits in between which you are interested of how your circuit behaves. In this particular case, you should choose the interval between 1 kHz and 10 MHz. Once you click ok, a shadow text will be anchored to your mouse pointer. Place the text on the schematic by clicking anywhere on worksheet.

 

 

Figure 4 – Set up the AC analysis

It is now time to run the simulation and view the results. The simulation is ran in the same manner like indicated in the previous article, and when it is finished (for this schematic it should be instantaneous) the plot window is opened. We should first display the amplitude of the signal at the output of the filter:

 

 

Figure 5 – Amplitude of signal at filter output

However since this is a filter, we are interested to see how it attenuates the signal fed at its input, so we would actually like to see the ratio between the amplitude at the input signal and the amplitude of the output signal. In order to plot this ratio, right click on the “V(output)” text in the plot window and this will pop up the Expression Editor dialog box. Here you can enter the formula you want to plot, and you should change the text written in the available text box to:

 

 

Figure 6 – Formula that we want to plot

Once you enter the desired formula, press ok and the plot will be updated to:

 

 

Figure 7 – Updated plot

The plot now displays two things that are of interest for this simple circuit: the ratio between the signal amplitude at the output of the filter and the signal amplitude at the input of the filter (solid line), and the relation between the phases of the two signals (dotted line).
As expected, we can notice that at very low frequencies the ration between the input and output amplitudes is 0dB (which actually means they are equal in non-logarithmic terms), as the capacitor acts as an open and the filter resistor is negligible compared against the load resistor. However, as the frequency increases, the capacitor starts to matter more than the resistor and we notice a decrease in the amplitude of the output signal (taking into account that the input signal amplitude remains constant).
It would be interesting to find out the cut-off frequency of this filter, which is defined in theory at -3dB from the maximum. We can do this easily in LTspice using the cursors in the plot window. To attach a cursor to a plot, we need to open up the Expression editor again, by right-clicking on the name of the displayed signal, and by assigning the 1st cursor to this waveform in the “Attached cursor” combo box:

 

 

Figure 8 – Attach the cursor

Once you click OK, a cursor is available on the plot, and you can move it around by clicking (and holding) the mouse pointer on the intersection point between the cursor and the solid green line:

 

 

Figure 9 – Plot with cursor attached to waveform

Also a new small window is open, indicating the coordinates of the cursor on the two axes. Move the cursor around, until the newly opened window displaying the coordinates indicates a magnitude (the “Mag” textbox) of -3dB.

 

 

Figure 10 – Window displaying the coordinates of the cursor

At this point, you should be able to read the cutoff frequency in the “Freq” textbox: approximately 5.28 kHz.

Who's online

There are currently 0 users and 19 guests online.

Recent comments