DC Sweep: Ideal vs. P-N Junction Diodes (I-V Plot Comparison)

Scroll through the screenshots below to learn how to run a DC Sweep simulation to plot an I-V curve. DC Sweep lets you see how a whole circuit responds as any parameter is varied.

Click and drag a voltage source, a resistor, and a P-N junction diode from the toolbox to your schematic:

Drag wires extending from terminal endpoints to complete the circuit:

Press G and then click to insert a ground node at the bottom of the voltage source:

Double-click diode D1 and change it to a 1N4001 part number:

We're done wiring up our circuit. Click Simulate at the bottom of the screen, then click to expand the DC Sweep tab:

Click in the Parameter box. An autocomplete appears, showing all the various circuit parameters we can use as our independent variable. Click to select "V1.V":

Type "-1" in the Start field, "2" in the End field, and "1m" in the Step field:

Hover your mouse over the anode of D1. A grey circle appears over the terminal:

Click this grey circle at the terminal. Observe that two Outputs have been added to the list:

Click the X next to V(D1.nA) in the Outputs list to remove it, since we're only interested in plotting the current:

Click the Run DC Sweep button. A plot window appears:

Our independent variable V1.V is on the x-axis, and the diode current I(I1.nA) is on the y-axis. Observe that the diode barely lets any current flow in reverse, but as the forward voltage rises beyond 400-500mV, current begins to flow.

Click Build at the bottom of the screen to return to build mode:

From the toolbox, click and drag an Ideal Diode and one more resistor to sit parallel to V1:

Click and drag wires from the new component endpoints to wire up R2 and D2 in parallel with R1 and D1:

Click Simulate at the bottom of the screen to bring up the simulation settings again:

Hover your mouse over D2's anode and click. Again, we'll see two new Outputs added to our list:

Click the X next to V(D2.nA) in the Outputs list, as we're only interested in currents:

You should now have only two Outputs in the list, I(D1.nA), and I(D2.nA), indicating the currents flowing into the anode node of D1 and D2 respectively:

Click Run DC Sweep. A new plot window will appear:

The two traces are partially overlapping for negative voltages, making it hard to see. Click I(D1.nA) in the plot legend to temporarily hide a trace:

The ideal diode is a theoretical piecewise-linear element which conducts perfectly forward, and conducts not at all in reverse. In contrast, the PN junction diode models real-world devices which transition smoothly, not abruptly, and with nonzero voltage drop.

Let's adjust the voltage offset of the ideal diode D2 to make it more closely behave like D1. Click Build to return to build mode, then double-click D2 and set its V_D to 0.7 volts:

Press F5 to repeat the simulation:

Now that it doesn't turn on until 0.7 volts, the ideal diode much more closely matches the real diode, except for the sharp vs. soft knee around the turn-on point.

You'll want to use a PN Junction diode when you're trying to accurately real-world devices. However, the simpler ideal diode model comes in handy when you're just learning about rectification and don't need the complexity of the full silicon model. The ideal diode is also perfect for use in designing switching power supplies (like buck and boost converters) and other situations where much faster simulations are preferable to precisely accurate diode behavior.

The DC Sweep mode is useful not only for sweeping over a voltage or current source, but can also sweep over other parameters, like a resistor's resistance, a potentiometer's knob, or even device internal parameters.

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


« Return to Table of Contents

Search Documentation


About CircuitLab

CircuitLab is an in-browser schematic capture and circuit simulation software tool to help you rapidly design and analyze analog and digital electronics systems.