LTspice: Basic Steps in Generating a Bode Plot of SMPS

Determining the open loop gain from a closed loop switch mode power supply (SMPS) is best solved using Middlebrook’s method, which appears in the International Journal of Electronics, Volume 38, Number 4, 1975. This method injects test signals into the closed loop system to independently solve for the voltage and current gains so that the loop remains closed and operating points undisturbed. Using the voltage gain portion of the Middlebrook method is particularly useful in performing a frequency response analysis (FRA) of an SMPS in LTspice IV.

To perform a FRA of a switch mode power supply in LTspice:

  • Insert a voltage source with a value of “SINE(0 1m {Freq})” in the SMPS feedback loop in series with the feedback pin and label the nodes of this voltage source “A” and “B” as shown. The choice of amplitude (1mV) impacts accuracy and the signal to noise ratio. Lower amplitudes lower the signal to noise and the larger the amplitude the less relevant the frequency response will be. A good starting point is 1mV to 20mV.

Insert a Voltage Source
Insert Voltage Source

  • Paste the following .measure statements on the schematic as a SPICE directive. These statements perform the Fourier transform of nodes A and B, compute the complex open loop gain of the SMPS, resulting magnitude in dB and phase in degrees.

.measure Aavg avg V(a)
.measure Bavg avg V(b)
.measure Are avg (V(a)-Aavg)*cos(360*time*Freq)
.measure Aim avg -(V(a)-Aavg)*sin(360*time*Freq)
.measure Bre avg (V(b)-Bavg)*cos(360*time*Freq)
.measure Bim avg -(V(b)-Bavg)*sin(360*time*Freq)
.measure GainMag param 20*log10(hypot(Are,Aim) / hypot(Bre,Bim))
.measure GainPhi param mod(atan2(Aim, Are) - atan2(Bim, Bre)+180,360)-180

  • Paste the following SPICE directive on the schematic. Parameter t0 is the length of time required for the system to settle to steady state and also sets when the simulator starts saving data. The difference between start and stop times in this case has been chosen as 25/freq so that the error from a non-integral number of switching cycles is small, since many cycles are included.

.param t0=.2m
.tran 0 {t0+25/freq} {t0}

  • Insert a .step command to set the frequency range over which you want to perform the analysis. In this example, the simulation runs from 50kHz to 200kHz using five points per octave. Hint: Before stepping through the entire frequency range, test at a couple of frequencies (e.g., insert “.param Freq = 125K”) and look at V(A) and V(B) to ensure you have sufficient amplitude in your voltage source, and if possible, tighten up the frequency range to minimize simulation time. The .options and .save statements are included to improve precision yet minimize the number of measurements.

.step oct param freq 5K 500K 5
.save V(a) V(b)
.option plotwinsize=0 numdgt=15

  • Run your simulation (see bottom left corner for status update).
  • To view the Bode plot, open the SPICE Error Log (choose SPICE Error Log from the View menu) and right-click on the log to select “Plot .step’ed .meas data”. Choose Visible Traces from the Plot Settings Menu. Select gain. From this plot you can then determine the crossover frequency and phase margin of your SMPS design.

Bode Plot Example
Bode Plot

Further examples and documentation can be found in the educational examples (..\LTspiceIV\examples\Educational\FRA\) and under the FAQ section of the Help Topics (press F1).

LTC1735: Fixed-Frequency, Peak-Current Mode Switcher Example
Frequency Response Analysis Example



Gabino Alonso

Gabino Alonso is currently the director of strategic marketing for the Power by Linear™ Group. Prior to joining ADI, Gabino held various positions in marketing, engineering, operations, and education at Linear Technology, Texas Instruments, and California Polytechnic State University. He holds a Master of Science degree in electrical and computer engineering from University of California, Santa Barbara.