Frequency Response

with LTspice IV


University of Evansville

July 27, 2009


In addition to LTspice IV, this tutorial assumes that you have installed the University of Evansville Simulation Library for LTspice IV. This library extends LTspice IV by adding symbols and models that make it easier for students with no previous SPICE experience to get started with LTspice IV.


An Example Circuit


In LTspice IV AC analysis can be used to determine complex node voltages and device currents as a function of frequency. All nonlinear elements are replaced by linear models, so results are only meaningful if nonlinear elements are actually operating in a linear mode. (Use Transient analysis to determine the response of of nonlinear circuits.) AC analysis is useful for determining the frequency response of filters and the bandwidth and stability of amplifiers.


We will use LTspice IV to determine the phasor voltage Vo in the circuit shown in Figure 1. The impedance seen by the current source is equal to , since the input current is equal to 1 A, the circuit impedance is equal to Vo. The technique used here can be used to determine the impedance of a circuit as a function of frequency or the frequency response of a filter.


Figure 1: Example Circuit


After clicking on the Run Simulation icon, the Edit Simulation Command dialog will appear as shown in Figure 2. Select the AC Analysis tab. In Figure 2 parameters are set to perform an AC Analysis on frequencies between 10 Hz and 1 kHz. The analysis will be performed at 30 frequencies per decade. (1 kHz is 2 decades above 10 Hz, so the analysis will be run at a total of 60 different frequencies.)


After the simulation run, node voltages and device currents can be probed. They will then be plotted in the Waveform Viewer. Figure 3 shows the result of graphing Vo. Vo is complex and by default the magnitude (in dB) and the phase angle (in degrees) are graphed. The magnitude is shown as the solid line while the phase is the dashed line. The left vertical axis is the magnitude axis while the right vertical axis is the phase angle axis. The magnitude and phase can be graphed in separate plot panes as shown in Figure 4.


The theoretical expression for the impedance of the circuit shown in Figure 1 is



One of the very nice features of LTspice IV is its ability to plot theoretical expressions alongside simulated results. Figure 5 shows the result of plotting the theoretical impedance expression along with the simulation result. The results completely overlap on the graph. (Note that the imaginary unit is i, not j, when entering expressions. See the Waveform Arithmetic section of the online help for a list of available mathematical functions that can be used when entering expressions.) The theoretical expression is saved in the Plot Settings file when you select Save Plot Settings from the Plot Settings menu.


Figure 2: AC Analysis Settings


Figure 3: AC Analysis Simulation Results


Tips


  1. When the Waveform Viewer window is visible you can move the cursor over either vertical axis or the horizontal axis and the cursor will change shape to a ruler. If you then left-click the mouse a dialog window appears that allows you to change several options corresponding to that axis. The dialog window for the left vertical axis allows you to select between Bode (magnitude and phase versus frequency), Nyquist (imaginary component versus real component) or Cartisian (real and imaginary components versus frequency). In Bode (default) mode you can further change the left vertical axis to use a Linear, Logarithmic, or Decibel (default) scale. The right vertical axis can be changed so that the group delay is plotted instead of the phase. The frequency (horizontal) axis can be changed between a linear and logarithmic (default) scale.


Figure 4: AC Analysis Simulation Results


Figure 5: Plotting Theoretical and Simulation Results


  1. AC Analysis calculates the response versus the frequency in Hertz by default. By changing the simulation command to:


.ac dec 30 {100/(2*pi)} {10k/(2*pi)}


the frequency response is calculated between 100 rad/s and 10 krad/s. The plot (shown in Figure 6) still shows the response versus the frequency in Hertz though. To plot versus the angular frequency in rad/s, change the simulation command to:


.ac list {w/(2*pi)}


and add the following SPICE directive to the schematic:


.step dec param w 100 10k 30


The response will then be plotted versus the angular frequency as shown in Figure 7.


Figure 6: Response from 100 rad/s to 10 krad/s (Axis in Hertz)


Figure 7: Response from 100 rad/s to 10 krad/s (Axis in rad/s)


  1. Finally, there are Laplace sources available in the UE/LTspice library. These require adding a SPICE .func directive to the schematic as shown in Figure 8. This directive is used to define the desired transfer function. You can add a Laplace source to an existing circuit schematic so that you can compare the theoretical and simulated frequency responses.


Figure 8: A Laplace Voltage Source


4 of 4