# LTspice: How to add trace of two swept values

I'm sure there is a really simple explanation for this, but I can't seem to figure it out. I am sweeping the series resistance of the source voltage and I am trying to see the transfer function output.

When plotting the $$\V(out)\$$ and $$\V(in)\$$ plots separately, the different plots are shown for increasing values of series resistance. However, when I "add trace" as $$\\frac{V(out)}{V(in)}\$$, only one plot appears. How do I get plots of $$\\frac{V(out)}{V(in)}\$$ for all the different values of series resistance?

Alternatively, is there a way I can plot $$\\frac{V(out)}{V(in)}\$$ directly rather than going into the waveform viewer and using "add trace"?

Any insight on this problem would be greatly appreciated.

• Why do you think that it's different for every step? Looks to me that there's a 6 dB difference between vout and vin for every step in the beginning, so it should just be a single line, and it also matches at the end.
– pipe
Commented Jun 26, 2019 at 16:51
• This might not meet your definition of 'directly', but I've just discovered bv, behavioural voltage source, and am over-using it. On the schematic, place a bv, with an expression =V(out)/V(in), then plot the output of that. Commented Jun 26, 2019 at 17:00
• To compute Sensitivity on the other hand is just a derivative of dG(s)/dR Commented Jun 26, 2019 at 18:01
• @pipe Nice catch. There is a consistent difference between V(out) and V(in) which is why all the plots are overlaid and it looks like there's only one plot. I should have caught that earlier. Appreciate the help. Commented Jun 26, 2019 at 19:11

If you're using a voltage source as the input and if the input resistance is part of the builtin parasitic (Rser) then you don't need to plot V(out)/V(in), V(out) will suffice. Otherwise, the behavioural source suggested in the comments and answer will do.
If you want to plot the result of a single value from the .STEP command, then use the @<step_number> selector, for example V(out)@3 will plot V(out) with the results from the third step. This also works for V(out)@3/V(in)@3, and you can make combinations, V(out)@3/V(in)@2.
The @ selector will not work in the behavioural source expression for obvious reasons: the behavioural expression needs to be evaluated at runtime, the latest, so you can't use V(out)@2 before the first step has been run, for example.