Calculating impedance using AC sweep?

Here’s my schematic:

I am trying to plot the input impedance of my circuit against different frequencies. How do I get a plot of impedance (of the voltage source V1) vs frequency (of V1) using the simulator? It seems like I can only plot voltages (when I click add signal).

Currently ngspice does not support storing and retrieving ac currents, thus there will be no small signal impedance calulations.

We are discussing if and how to relieve this restriction.

In the meantime, I came up with this hacky solution:

I can plot the voltage across the 0.01 ohm resistor to get the current, and I can also get the voltage of the voltage source. If I divide these two I should be able to determine the impedance.

Do you know how I can plot math equations, like V1/(R6*100) or something?

Currently you cannot, the Eeschema/ngspice interface is still limited here.

A hacky solution for such functions:

Make a subcircuit model and use a symbol (here with one input and one output, but may be more inputs, the ngspice B source is very flexible).

.subckt functionplot in out
B1 out 0 V=V(in)/<value of R6>/100

Put this into a file, attach it to the symbol, connect the symbol to the input node(s) of interest, add a global label to the output (if you are just interested in simulation, not the PCB, global labels as node names are o.k.), run the simulation and plot the output of the new symbol.