# Divide Sequencial Parameter Step in Spice

I've been designing a (very) simple MOSFET op-amp for school, and one of the things I need to do is determine the CMRR from my simulations. For the assignment, I'm just going to use the value at 1kHz, which should fulfill the assignment requirements. However, thinking about it made me wonder if there is a way to make LTSpice (or any other version of Spice) plot the CMRR over multiple frequencies?

I won't show the circuit, as this question is relevant to differential amplifiers in general, but here are the directives I'm using to run my current simulation:

.ac dec 100 1 100Meg
.step param vi list 0 1


vi is an AC voltage parameter for the non-inverting input, and the inverting input has a fixed value of AC 1.

Here is the result, measured at the output:

The black line (vi=0) shows the open loop frequency response with a differential input and the blue line shows the response with a common-mode input. In other words, it simulates these two circuits:

simulate this circuit – Schematic created using CircuitLab

I am wondering if there is a way to divide two instances of the same parameter. In other words, I want to divide the output voltages corresponding to the differential and common-mode gains so that I can do something like this:

$$CMRR = \frac{v_o|_{v_i=0}}{v_o|_{v_i=1}}$$

Yes there is: 1) Plot a signal 2) Right click on the signal name in the plot 3) The Expression editor pops up, you can now feel free to enter in a math expression, make sure if you include nodes you specify if you want a voltage with V(node) or current with I(node)

Here is an example of dividing one voltage node (named vout1 and vout2) by another with this expression V(vout1)/V(vout2)

Info on LT Spice algebraic expressions

Note: Alt-click on components which will generate a temperature plot, this also creates an expression.

Another cool trick is to use V(vout1)/I(r1) to plot the impedance of a node

• That is helpful advice, but it doesn't answer my question. I am wondering specifically about creating an expression that involves two instances of the same node. Both of my measurements are of vo, but they correspond to different values of another parameter. – Caleb Reister Mar 23 '17 at 7:49
• I thought you'd be able to figure that out and I didn't see your spice code so I thought you had already duplicated your circuit and that duplication was implied. So, you duplicate your circuit and run two different copies of your circuit in the same simulation and have two output nodes, then you use the algebraic expressions in the plotting to find the CMRR. I run dupilicate circuits in simulations all the time. – Voltage Spike Mar 23 '17 at 15:27
• Guess I could do that. – Caleb Reister Mar 23 '17 at 15:37

You don't need to do such things inside LTSpice. Just export the results of two independent simulations into CSV files and do the math and plot in any spreadsheet or Matlab-like application.

Instuction how to export the data can be found here: http://www.linear.com/solutions/1815