# LTspice: Plotting a Parameter Against Something Other Than Time (e.g. Resistance)

A common use for LTspice® is to run a time domain transient analysis where a parameter (e.g. voltage or current) can be plotted against time. Occasionally, you may wish to know the behavior of a circuit versus another parameter such as resistance. This can be done by using the “.measure” and “.step” SPICE directives along with the SPICE Error Log.

Output Voltage of a Programmable Current Source vs. Load Resistance

The LT3092 is an easy to use programmable current source. It is chosen for this example due to its easy to understand operation and quick simulation time.

With ROUT = 5Ω and RSET = 20kΩ the LT3092 produces a temperature stable 40mA current source with a wide compliance range. Imagine a case where this current source drops across a variable resistor and we wish to plot the load voltage vs. the changing resistor. A link is provided on the right panel to an LTSpice file, which illustrates the process. The following are the basic steps to achieve the desired results.

1. Open a new schematic in LTspice, insert LT3092 symbol by pressing the ‘F2’ function key and finish drawing the schematic and labeling the nets as follows.

2. Right click on the schematic and edit the simulation command to the following.

.tran 0 510m 500m

Above we mentioned that it would be nice to plot a parameter against resistance. To be exact, what we want to do is to plot the voltage at node ‘LOAD’ once the simulation has reached steady state. In this circuit, we know that the LT3092 reaches steady state long before 500ms. So we run the simulation for a given resistor for 500ms, then start saving data for the next 10ms.

3. Insert the following SPICE directives into the schematic by selecting 'S' on your keyboard.

.step param X 10 30 1
.option plotwinsize=0 numdgt=15

The .save statment only saves voltage data for node 'LOAD' which can help speed up large simulations.

The .step command steps the paramater 'X', in this case a load resistor, from 10Ω to 30Ω in 1Ω increments. This means the simulation must run 21 times. So take care that more complex simulations make take some time to complete.

The .measure calculated the average voltage of node 'LOAD' and store it into the variable 'VLoadAvg'.

Lastly, the .options statment sets plotwinsize = 0 which disables compression and numdgt is used to set significant figures used for output data. If numdgt > 6, double precision is used.

4. Run the simulation.

When the simulation runs, the .measure statement output is put in the .log file which can be viewed in the SPICE Error Log. If the simulation includes a .step command, the .measure statements are executed for each step and the results are printed as tables in the .log file. These tables for .measure results can then be plotted like normal waveforms by the following.

5. To view the resulting data in the waveform viewer, use CTRL-L to open the SPICE Error Log and right-click on the log to select “Plot .step’ed .meas data”.