The operating point, sweeps and frequency response

Three readings one probe will not give you: every node's voltage at once, what a node does as you turn something, and what the circuit does at every frequency.

The DC operating point

Press Shift+O, or the meter button on the canvas toolbar, or DC operating point in the more menu. Every net that has a wire gets a label with its voltage, and every part you select shows its current in the properties panel. Press Shift+O again to dismiss it.

It works whether or not the simulation is running. With nothing running, the circuit is built, switched on, read, and let go again, so what you get is the circuit at the instant it is plugged in. With a simulation running, you get the same reading taken at that moment, and the panel says which: it prints t = 0 s for a power-on reading and the simulated time for any other.

What the labels say

A net solved by the matrix reads as a plain voltage: 2.500 V.

A net resolved by the fast path reads with its logic level first: H 5.000 V. Those are not the same kind of answer and the label does not pretend they are. Most of a circuit is digital and stays off the matrix, and its nets are resolved one driver at a time rather than solved simultaneously. The voltage is still the model's voltage; it is a different model.

A net with nothing driving it reads Z and no number. A floating net has no voltage, so there is none to print.

Numbers are printed to four significant figures with an engineering prefix: 250.0 µA, 13.64 mA, 2.500 V. Four figures is the solver's own relative tolerance, so the last figure shown is the last one the engine stands behind, and a quarter of a milliamp never prints as 0.000 A.

Currents, and why some parts have none

Select a part while the operating point is up and the properties panel gains an Operating point section.

Where a part is in an analog island, its current comes out of the matrix, one line per element it stamped, with the voltage across each. The panel says "solved in the matrix".

Where it is not, the panel falls back to the part's own reading (a resistor reports its current whether or not it ended up in a matrix) and says "from the part, resolved per driver".

Where the part has neither, the panel says so rather than printing a zero. An LED reports brightness, not amps; a logic gate reports its output level. Those are not currents and the panel will not dress them as ones.

A circuit gets a matrix only when something in it needs one: a capacitor, an inductor, an op-amp, a signal generator, or a multimeter set to ohms. A plain divider of two resistors is resolved on the fast path and has no branch currents, though its resistors still report their own. Drop a capacitor, a multimeter or a scope into the circuit and the nets it touches become an island, and then everything on that island has a current.

What the operating point is not

This is the operating point the circuit powers on at, not SPICE's .op. The difference is the reactive parts: here a capacitor starts discharged and an inductor starts at zero current, because that is what a circuit that has just been switched on does. SPICE treats a capacitor as an open circuit and an inductor as a short.

So an RC divider read at power-on shows the tap at 0 V and the whole supply across the top resistor, which is true and is what you would measure. For the settled DC answer, run the circuit until it has settled and take the operating point then; the time in the panel header tells you where you are.

The device models behind these numbers are real ones. A diode and an LED are Shockley junctions, solved for the current they actually pass rather than held at a forward drop somebody wrote down; a bipolar transistor is Ebers-Moll in its transport form, with forward and reverse betas and an Early voltage; a MOSFET is the level-1 square-law device. The island is solved by Newton-Raphson, so a bias point, a rectifier's output and a switch's on-resistance are the model's own answers, each checked against a hand solution and against ngspice 42 before it shipped. See the diode, LED, transistor and MOSFET help articles for the parameters and the numbers they were verified against.

The op-amp is a single-pole macromodel rather than a transistor-level device: it has a gain-bandwidth product, a slew rate, headroom short of its rails, an input offset and an output current limit, but no bias current and no input resistance. A bias point read around one is that model's bias point. docs/help/parts/opamp.md says so in full.

Sweeps

Analysis… in the more menu opens a sheet with three things in it: a DC and parameter sweep, a frequency response, and the transient time step. The first two are analyses and the third is a setting.

The top of the sheet is the DC sweep and the parameter sweep. They are the same thing, and the only difference is what you pick to step.

Pick something to step, a range, and a net to watch. Press Run the sweep and you get V(net) against the swept value, with both axes labeled in their units, and a Download CSV button with every net's voltage and every analog part's current in it at full precision.

Anything you can set as a number can be swept: a supply's voltage, a function generator's offset or amplitude, a resistor's value, a capacitor's value, an op-amp's gain. A potentiometer's shaft can be swept too, and it is the one that is not a property. It is a count from 0 to 1023, so the sweep lands on whole counts and says so under the plot.

How each point is taken

For a property, the circuit is rebuilt at each point with that one number changed and switched on, so every point is a cold start. That has a consequence worth knowing: every capacitor is discharged at every point, so a sweep of a circuit with a capacitor in it reads the power-on answer at each step and not the settled one. Set Settle each point for to a few million nanoseconds and each point is run that far before it is read, at which point it is no longer a DC answer, and the note under the plot says so.

For a shaft, the sweep runs on the live circuit and each point continues from the one before, which is what a real knob does.

Whatever makes a sweep less than the whole story is printed under the plot in words. Read that line.

The most points one sweep will take is 1001. Past that it is refused with the count in the message rather than run, because a sweep is a thousand rebuilds of a circuit and ten thousand would be a hang.

Frequency response

The middle of the analysis sheet. Pick a signal generator to drive, pick the net its signal goes in on and the net you want to watch, pick a range in hertz and how many points a decade, and press Run the frequency response. What comes back is a Bode plot: how much of the signal gets through at each frequency, over a frequency axis that goes in decades.

What an AC analysis actually is

It is not a run. Nothing moves, no time passes, and the circuit is left exactly where you found it.

What happens instead is this. The engine takes the circuit as it is sitting right now (every bias voltage, every transistor's operating point) and asks one question at each frequency: if I wiggle the input by a tiny amount at this frequency, how big is the wiggle at the output, and how far behind or ahead is it? To answer it, every part is replaced by the straight line that best fits its behavior at the point it is sitting at. A resistor already is a straight line. A capacitor becomes an impedance that shrinks with frequency, an inductor one that grows with it. A transistor becomes its transconductance: how many milliamps of collector current one millivolt on the base is worth, right there at that bias, and nothing else.

That is what small-signal means: small enough that the straight line is a good fit. It is the assumption every amplifier design in every textbook is built on, and it is the reason the answer is a ratio and does not depend on how big you imagine the signal being.

It is about the operating point the circuit is holding

Exactly like the operating point reading above, and for the same reason: the analysis is taken about the state the engine is holding at that moment.

With nothing running, that is the power-on bias. With a simulation running, it is the bias at that instant, and the line under the plot says so with the time in it. Change the bias (turn a supply down, move a pot) and the response changes with it, because a transistor's gain is its bias current over the thermal voltage and nothing else. That is not a quirk; it is what biasing is for.

An op-amp that the operating point left saturated is analyzed saturated: its small-signal output is zero, and the plot will be a flat floor. If your amplifier plots as nothing at all, check the operating point first. It is almost always sitting on a rail.

How to read a Bode plot

Two panes over one frequency axis.

The top pane is gain, in decibels. Decibels are a ratio on a log scale: 20 log10(out / in). The three numbers worth memorizing are

  • 0 dB: the output is the same size as the input.
  • −3 dB: the output is 0.707 of the input, which is half the power. This is the marked line, and it is the conventional edge of a passband.
  • −20 dB: the output is a tenth of the input. −40 dB is a hundredth.

The bottom pane is phase, in degrees: how far the output wave is shifted against the input. Negative is behind (lagging), positive is ahead (leading).

The frequency axis runs in decades (every equal step across is a factor of ten), with the faint lines between them at 2, 3, 4 … times each power of ten. A log axis is what turns a filter into straight lines, which is the whole point of drawing it this way.

Then read the shape:

  • A flat stretch is a passband: everything there gets through unchanged.
  • A straight slope down is a rolloff, and its steepness counts the reactive parts. One capacitor or one inductor gives 20 dB a decade; two give 40.
  • The corner is where flat meets sloping, and it is marked on the plot with the frequency printed on it. For an RC that corner is 1 / (2 pi R C), and at the corner the phase is exactly 45 degrees: a lag for a low pass, a lead for a high pass. Seeing the phase pass through 45° where the magnitude passes through −3 dB is the check that you are looking at a single-pole corner and not two poles close together.
  • A peak means resonance. How tall and how narrow it is, is what Q means: a series RLC's peak across the capacitor is Q times the input, and the width between the two −3 dB points either side of it is the center frequency divided by Q.
  • Gain above 0 dB means the circuit amplifies. Only a circuit with a transistor or an op-amp in it can do that; a filter made of resistors, capacitors and inductors never rises above 0 dB, and if yours appears to, look for a resonance that is storing energy rather than making it.

The marker is placed where the curve crosses three decibels under its own peak. The engine solves at the frequencies you asked for and no others, so that crossing is read off the curve between the two solved points either side of it; the note under the plot says so. More points a decade sharpens it. Twenty a decade puts the corner of an RC within about a tenth of a percent.

What is modeled, and what is not

Modeled, and checked against hand solutions and against ngspice before it shipped: every resistor, capacitor and inductor at its true impedance; every diode, LED, transistor and MOSFET at its own small-signal conductances at the bias it is actually sitting at; and the op-amp with its dominant pole.

Not modeled, and none of it is a rounding error:

  • No capacitance inside any device. A transistor here has no base-emitter or base-collector capacitance, a MOSFET has no gate capacitance, a diode has no junction capacitance. So no device has a high-frequency corner of its own: a common-emitter stage's gain stays flat to any frequency you ask for, where a real 2N3904 would be falling away by a few megahertz and would have a Miller effect on top. Every rolloff you see here comes from a capacitor or an inductor you put in the circuit yourself. That makes the low corner of a coupled amplifier right and its high corner absent.
  • No noise. There is no noise figure, no thermal noise, no shot noise and no noise floor on the plot.
  • No distortion. A small-signal analysis is linear by construction, so there are no harmonics in it, no clipping and no intermodulation. Push a real amplifier hard and it distorts; this plot will never tell you when.
  • The op-amp has one pole. Its open-loop gain falls from the model's DC gain at 20 dB a decade and reaches one at its gain-bandwidth product, so an amplifier's bandwidth is the gain-bandwidth product over its noise gain and an active filter rolls off where its op-amp runs out of gain. There is no second pole, so the plot never shows an op-amp losing its phase margin, and a slew rate is a large-signal limit that a small-signal analysis never reaches.

What that adds up to: this is the right tool for a filter, a resonator, a coupled amplifier's low end and anything where the frequency behavior comes from components you can point at. It is the wrong tool for the high-frequency limit of an amplifier, for noise, or for anything an oscilloscope's distortion would show you.

The CSV

Download CSV gives you the whole table at full precision: frequency, gain in decibels, phase in degrees, and the two raw phasor magnitudes the ratio was taken from. The two raw ones are there because a function generator drives through 50 ohms and so does not put its whole volt on the net it drives. The gain divides that out, and the file shows you what it divided.

Try it

Three built-in circuits put a real frequency response on the plot. RC filter on the bench is the single corner above, a plain low pass with a scope and a meter to read it two ways. RLC resonance on the bench is a peak instead of a corner: a series resistor, inductor and capacitor whose ring you can sweep by hand, with the -3 dB marker sitting on each side of it rather than just one, and Q written right there in how tall the peak is. Op-amp low pass on the bench is the one circuit here with gain above 0 dB in its pass band, and the note beside it says plainly which parts of the plot are the ideal op-amp talking and which are the real Rf and Cf. All three are in the editor's Examples menu and on the templates gallery.

The time step

The bottom of the sweep sheet sets the transient step.

Left at 0 (the default, and right for almost everything), the solver chooses every step from the error it is making, between 100 nanoseconds and 2 milliseconds. Set a longest step and no part of the circuit takes a longer one. Tick Exactly this step and every step is that step.

Two reasons to reach for it. One is a curve that looks like a staircase: the answer at each step was right and there were not enough of them for the picture. The other is a comparison against a textbook or another simulator that ran at a fixed step.

It costs what it says. A 1 µs step over a 20 ms window is twenty thousand steps a screen, and the speed readout in the header will tell you about it; see the simulation runs slow.

Two things still shorten a forced step, both deliberately: the solver lands on a source's edge rather than integrating through it, and it refines onto a logic threshold a net crosses, so a trip time is not lost inside a long step. Nothing ever lengthens one, so a forced step is a promise of "at least this fine".

The setting belongs to the document, not to your browser: a lesson that says "set the step to 1 µs and look at the ringing" travels with its step.

How the step is integrated

Trapezoidal, and Gear 2 where trapezoidal rings.

The trapezoidal rule is the default and stays the default. It is second order, so it is accurate, and on a lossless circuit it neither adds energy nor takes it away: an LC tank rings here for exactly as long as its Q says it should. A first-order method would damp it out, and a resonator that quietly dies is a wrong answer you cannot see is wrong.

What the trapezoidal rule is bad at is a step much longer than the fastest time constant in the circuit. It does not settle there, it alternates: a sawtooth of the integrator's own making sitting on top of the answer, which textbooks call trapezoidal ringing. A hard switching edge into an inductive load is exactly that circuit.

So the solver watches for it. When an energy-storage state alternates about its own trend on consecutive steps, by more than its own tolerance, the next few steps are integrated with Gear 2 (second-order backward differentiation, what SPICE calls METHOD=gear), which is stable at any step and damps the ripple away instead. Four steps after the last sighting of it, the solver goes back to trapezoidal.

This is a fallback, not a mode. It is not a setting, there is nothing to turn on, and it does not fire on a real oscillation: the step is already held to a fraction of the local time constant and of any generator's period (sixty-four of each), so a real oscillation is sampled dozens of times a cycle and keeps the sign of its movement for many steps at a time. An alternation on consecutive steps is two samples a cycle, which is the integrator's ripple and nothing the circuit is doing.

The first step after any discontinuity (a source edge, a switch, a part changing value) is backward Euler, which cannot ring at all, and the step after that is back on the trapezoidal rule.

What this costs you, honestly: Gear 2 adds a little numerical damping while it is in use. That is the trade it exists to make: a ripple that is not real, against a decay that is slightly faster than real. That is why it is only ever on for a handful of steps at a time. Measured against ngspice 42 on the same circuits: an RC step agrees to 14 µV, an RLC ring-down to 1.4 mV on a 1.73 V waveform, a common-emitter amplifier on a 1 kHz sine to 0.27 mV, and a MOSFET switching a motor to 3.7 mV on a 12 V rail.

A step for one scope

A scope has its own step property, which asks the island its probes are on for that step and nothing else. It is the right control when one corner of a circuit needs fine steps and the rest does not. The finest request on an island wins, so a scope asking for 1 µs and a run setting of 100 µs gives 1 µs on that island.

Where the numbers come from

Everything on these two readings comes out of the same solver the simulation runs on: modified nodal analysis over each analog island, and the per-driver model everywhere else. Nothing here is a second model kept alongside the first, which is why an operating point and a running simulation never disagree.