## Op-Amp Circuits Simulated Three Ways

Scroll through the screenshots below to learn how to analyze op-amp circuits at DC, in the time domain, and in the frequency domain.

Press / (forward slash) to begin a toolbox search, and type "op":

There are two op-amp models in CircuitLab, one with and one without voltage rails. The simpler "without" version simulates faster if you're not concerned with limiting the range of output excursion.

Click and drag the plain Op-Amp to the schematic.

Press / (forward slash) to begin a toolbox search, and type "1k". Then drag a 1k resistor to the schematic, pressing R to rotate it:

Press / (forward slash) to begin a toolbox search, and type "10k". Then drag a 10k resistor to the schematic, pressing R to rotate it:

Press G and click to insert a ground node near the op-amp's non-inverting input:

Clear the toolbox search and drag a Voltage Function Generator to the schematic. Press G and click to insert a ground node at its negative terminal:

Click and drag from element endpoints to wire up the circuit as shown:

Press N and click to add a node name at the input, and press N again to add another at the output. Double-click to label them "in" and "out":

Great! Now that our circuit is wired, letâ€™s simulate it. Click Simulate at the bottom of the window, then click to open the DC Sweep tab:

Set Parameter to "V1.DCOffset", and choose a Start of -1, End of 1, and Step of 10m. Then, click the "out" node name to add V(out) to the Outputs list:

Click Run DC Sweep. A plot window appears:

The DC sweep plot shows the behavior of the circuit with input voltage on the x-axis and output voltage on the y-axis. Clearly this is an inverting amplifier with a gain of -10.

Now, let's see how the circuit behaves in the time domain.

Click Hide on the plot window, and then open the Time Domain panel on the simulation settings window. Enter a Stop Time of 10m, a Time Step of 10u, and then click the "in" and "out" node name labels to add V(in) and V(out) to the Outputs list:

Click Run Time-Domain Simulation. A plot window appears:

Our function generator V1 is set to 1 kHz by default, but of course we can change it. Click Build to return to build mode, then double-click V1 and set its Frequency to 2k:

Press F5 to repeat the last simulation. A plot window appears:

The input frequency has doubled, and of course, so has the output.

Finally, let's look at the inverting amplifier in the frequency domain.

Click Hide on the plot window, then click to open the Frequency Domain tab of the simulation settings. Set the Input source to V1, then increase Points/Decade to 100. Click the "out" node name label to add DB(MAG(V(out))) and PHDEG(V(out)) to the Outputs list:

Click Run Frequency-Domain Simulation. A plot window appears:

The amplifier shows +20dB of gain (10x voltage gain) at low frequencies, and if you hover on the plot, you can find the bandwidth of about 350 kHz.

We've shown how to look at op-amps at DC, in the time domain, and in the frequency domain. Let's go back and add voltage rails to our op-amp and see how the behavior changes.

Click Build at the bottom of the window to return to build mode. Click to select OA1, and press Backspace or Delete to delete it:

Press / (forward slash) to begin a toolbox search, and type "op". Now, drag an Op-Amp With Voltage Rails onto the schematic, exactly lining up with where OA1 used to sit:

This op-amp symbol has two additional terminals for the voltage rails: the positive and negative supply limits for the amplifier.

Press / (forward slash) to begin a toolbox search and type "+5". Then, drag a +5V voltage node to OA2's top-side power input:

Press / (forward slash) and search for "-5", and dragin a -5V negative rail, pressing R to rotate the node name label:

Click to open the Run menu at the top of the screen:

Click DC Sweep. A plot window appears:

Notice that the DC sweep is now truncated as the op-amp's output saturates at the voltage rails.

Click to open the Run menu again, and click Time Domain Simulation. A new plot window appears:

Our output sine wave is truncated, chopped off, as the output saturates. This is called "clipping" and is probably not what we want!

(You can try the Frequency Domain as well, but it will be unchanged. That's because it only reflects small-signal deviations around the DC operating point.)

You should use the op-amp without voltage rails when possible because it's easier to wire up, keeps your schematic cleaner, and is faster to simulate. But when you are concerned about the output range, you can always use the op-amp model with rails.

That's it! You now can build and simulate op-amp circuits three ways.

Click below to open the final circuit, or try it yourself from scratch (recommended).