AC Analysis
AC analysis answers the question: how does this circuit respond to signals at different frequencies?
Every amplifier has a bandwidth. Every filter has a rolloff. Every feedback loop has a phase margin. AC analysis is how you see these things -- it sweeps across frequency, from hertz to gigahertz, and tells you the gain and phase shift at every point along the way.
The key insight is that AC analysis doesn't simulate a time-domain signal. It never applies a sine wave and watches the output. Instead, it takes a shortcut: linearize everything at the DC operating point, then solve the resulting linear system at each frequency. Because the linearized circuit is a purely linear problem, there's no Newton-Raphson iteration, no convergence concerns, no timestep control. Just one matrix solve per frequency point -- and each solve is complex-valued, because impedances at nonzero frequency have both magnitude and phase.
This is what makes AC analysis fast. A transient simulation of a 10 MHz sine wave through an amplifier might need thousands of timesteps. AC analysis gets the same frequency response information by solving a few hundred linear systems.
The cost: the signal must be small enough that the linearization is valid. AC analysis cannot tell you about clipping, distortion, or any behavior that depends on signal amplitude. For large signals, you need transient analysis (Chapter 9).
Small-Signal Linearization
AC analysis only works because of a powerful simplification: at the DC operating point, every nonlinear device can be replaced by a linear small-signal model.
The DC operating point gives each device a specific set of voltages and currents. These define a single point on the device's nonlinear I-V curve. If we add a tiny AC signal -- small enough that we don't move far from that point -- the device's response is approximately linear.
The diode: one conductance, one capacitance
The small-signal conductance is:
For a diode biased at
Together with a diffusion capacitance
The MOSFET: a richer model
The core small-signal parameters:
(transconductance) -- how much drain current changes when changes. This is the gain mechanism. (output conductance) -- how much drain current changes when changes. Channel-length modulation gives a small nonzero . (body transconductance) -- how modulates drain current via the body effect. - Capacitances --
, , , , . These determine the high-frequency behavior: as frequency increases, current flows through the capacitances and gain rolls off.
The key assumption
All of this rests on one assumption: the AC signal is infinitesimally small. The linearization is only valid for perturbations small enough that the nonlinear terms are negligible. This is why AC analysis has no concept of signal amplitude -- the circuit is perfectly linear in the AC world.
Complex Impedance and the AC Matrix
In DC analysis, the MNA matrix is real-valued. In AC analysis, the matrix becomes complex. This is where frequency enters the picture.
Why complex numbers?
A capacitor's behavior depends on frequency. The current through a capacitor leads the voltage by 90 degrees. Complex numbers encode both magnitude and phase:
Similarly, an inductor:
The AC MNA matrix
At each frequency point, the system to solve is:
The real part
Resistor stamps
The frequency sweep
For each frequency point, spice-rs computes ac_load() on every device, factors and solves the complex system, and stores the complex node voltages. The solution at each point gives magnitude (gain) and phase.
Bode Plots
The result of AC analysis is a table: for each frequency, a complex voltage at every node. The Bode plot is the standard visualization -- two plots showing magnitude and phase vs. frequency.
Magnitude: decibels
| Gain (linear) | Gain (dB) | Meaning |
|---|---|---|
| 1 | 0 dB | Unity |
| 0.707 | -3 dB | Half-power point (cutoff frequency) |
| 0.1 | -20 dB | One-tenth |
| 10 | +20 dB | Ten times |
Phase: degrees
A phase of
Frequency sweep types
DEC (decade) -- logarithmically spaced, most common. Each step multiplies by a constant factor.
OCT (octave) -- logarithmically spaced per octave, common in audio.
LIN (linear) -- uniformly spaced, useful for narrow-range zoom.
What Bode plots tell you
- Bandwidth -- the frequency range within 3 dB of the peak
- Rolloff rate -- first-order filter: -20 dB/decade; second-order: -40 dB/decade
- Resonance -- a peak above the passband level
- Phase margin -- stability indicator for feedback amplifiers
Filter Circuits
RC Low-Pass Filter
The simplest filter: one resistor, one capacitor. Low frequencies pass through; high frequencies are attenuated.
The transfer function is:
The magnitude and phase:
where the cutoff frequency is:
At the cutoff frequency: magnitude = -3.01 dB, phase = -45 degrees. Below
SPICE AC Analysis
The plot above was computed from the closed-form transfer function -- no simulator involved. Now let's run the real SPICE engine on the same RC filter and see what AC analysis produces.
The SPICE result matches the analytical formula exactly -- as it should for a linear circuit. The simulator assembles the complex MNA matrix
The value of the SPICE approach becomes clear when you move beyond passive filters to circuits with transistors, where no closed-form transfer function exists. The simulator linearizes each device at the DC operating point and sweeps -- the same machinery, applied to arbitrarily complex circuits.
RLC Series Resonance
Add an inductor and the circuit can resonate. At one specific frequency, the inductor and capacitor impedances cancel, leaving only the resistance.
The resonant frequency:
The quality factor:
A high-
From filters to amplifiers
These passive filter examples demonstrate the mechanics of AC analysis without nonlinear device complexity. But the real power of AC analysis is in circuits with transistors, where the small-signal linearization comes into play. An amplifier's frequency response is shaped by the same physics: parasitic capacitances create poles, feedback networks create zeros, and the interplay determines bandwidth, gain, and stability.
The math is the same. The matrix is larger. But the principle -- solve