The independent variable is R1. Two Dependent expressions are plotted. One is current thru R1; the other is the Resistance of R1 (R=E/I). Note that LTSpice knows what you are plotting, and it labels the plot axis automatically.
This feature in LTSpice is called a "Plot Expression".
If you need to make a resistor vary during simulation, you can do this:
Here R2 is set to 2*R1 during the simulation run. R1 is the independent variable of the simulation. R2 is determined as a function of the voltage and current through R1. The plots show that the (dependent) current through R2 is one-half of the current through R1.
Plotting the expression I(R2)/I(R1) shows that it is 0.5 (500m) for all values of R1 and R2.
My question probably wasn't very clear. But I found out later that I had to create functions in the polt.def file to get the plot I wanted.
My problem was...I couldn't use a resistor variable directly in a plot expression. I kept getting a error "undefined param" or something
like that.
I was exploring the use of a PGIA with different gain resistor values set by a analog switch.
What I needed was a plot showing the effect of different values of resistors with certain analog switch contacts.
That's a solution I haven't used before. My way just requires you to "do it on the fly" by adding a trace to a plot pane containing the term ((V2-V1)/I12), where V2 and V1 are the voltages at the ends of the "resistor", and I12 is the current through the "resistor". Those node voltages and branch currents exist in the .RAW file by default. My method can be done after the sim run.
Your way actually adds a new column of data to the .RAW file. It must be done before the sim run.
That's a solution I haven't used before. My way just requires you to "do it on the fly" by adding a trace to a plot pane containing the term ((V2-V1)/I12), where V2 and V1 are the voltages at the ends of the "resistor", and I12 is the current through the "resistor". Those node voltages and branch currents exist in the .WAV file by default. My method can be done after the sim run.
Your way actually adds a new column of data to the .WAV file. It must be done before the sim run.